Tarjima qoshish uchun havola boyicha o'tib Pull Request oching (havolaga o'tish).
Standart til uchun tarkibni ko'rsatadi.
import { withRegion } from "effector";
The method is based on the idea of region-based memory management (see Region-based memory management for reference).
Methods
withRegion(unit, callback)
The method allows to explicitly transfer ownership of all units (including links created with sample
, forward
, etc…) defined in the callback to unit
. As an implication, all the created links will be erased as soon as clearNode
is called on Unit.
Formulae
withRegion(unit: Unit<T> | Step, callback: () => void): void
Arguments
unit
: Unit | Step — which will serve as “local area” or “region” owning all the units created within the provided callback.callback
:() => void
— The callback where all the relevant units should be defined.
Examples
import { createDomain, createEvent, restore, withRegion, clearNode } from "effector";
const first = createEvent();
const second = createEvent();
const $store = restore(first, "");
const domain = createDomain();
withRegion(domain, () => {
// Following links created with `forward` or `sample` are owned by the provided unit `domain`
// and will be disposed as soon as `clearNode` is called on `domain`.
forward({
from: second,
to: first,
});
});
$store.watch(console.log);
first("hello");
second("world");
clearNode(domain);
second("will not trigger updates of `$store`");
Ingliz tilidagi hujjatlar eng dolzarb hisoblanadi, chunki u effector guruhi tomonidan yozilgan va yangilanadi. Hujjatlarni boshqa tillarga tarjima qilish jamiyat tomonidan kuch va istaklar mavjud bo'lganda amalga oshiriladi.
Esda tutingki, tarjima qilingan maqolalar yangilanmasligi mumkin, shuning uchun eng aniq va dolzarb ma'lumot uchun hujjatlarning asl inglizcha versiyasidan foydalanishni tavsiya etamiz.