realar-project / realar

5 kB Advanced state manager for React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

low: proposal for link (or bind) decorator for binding value to prop

betula opened this issue · comments

No have possibility to use "bind", because in classes with decorators style exists a usually "bind" decorator function that means bind context of the class method to this.

const v = value(0);
class A {
  @link v = v;
}
console.log(shared(A).v); // 0

For example, the cache alias will be

class A {
  @link c = selector(() => 0);
}
shared(A).c // 0

But no possible to reassign.

class Logic {
  @link lang = sharedLocale().$lang
}

Hmm.

Only one normal case I can find from all

class A {
  search = pool(async () => 0);
  @link pending = this.search.pending

}

But it's not enough for a proposal approval.