realar-project / realar

5 kB Advanced state manager for React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

low: autodestroyable uncontrolled scopes

betula opened this issue · comments

export class Locale {
  constructor() {
    link(on(() => this.code, (code) => console.log(code)));
  }

  createText = (source: TextSource) => {
    const text = value(source[this.code]);
    on(() => this.code, (code) => {
      text(source[code]);
    });
  }
}

Signature:
link(destructor);

Examples:

link(on(() => this.code, (code) => console.log(code)));
destruct(on(() => this.code, (code) => console.log(code)));
sub(on(() => this.code, (code) => console.log(code)));

But is it not comfortable.

isolate(on(() => this.code, (code) => console.log(code)));

For removing on destructor from context scope.