You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As saltCount is only listening on an instance of saltShaker, we can leave it bound once someone reads this.saltCount.
The following should work:
constsaltShaker=newSaltShaker();// when read, we notice that the observation is only listening on `saltShaker`:saltShaker.saltCount;// Now that saltCount is active, everything works:saltShaker.fill();console.log(saltShaker.shake())//-> "salt"console.log(saltShaker.shake())//-> "salt" console.log(saltShaker.shake())//-> null console.log(saltShaker.empty)//-> true
I think this would be REALLY nice for getters and async getters:
Obviously, there would still be corner cases like in saltShaker above. But overall, I think these sorts of behaviors would act more like people suspect.
Thoughts?
The text was updated successfully, but these errors were encountered:
justinbmeyer
changed the title
Allow retention of bindings on a read if only values directly on the observable are read
PROPOSAL: Allow retention of bindings on a read if only values directly on the observable are read
Sep 22, 2018
I'd like to retain "active" behavior on getters and async getters that only read values directly on their observable. For example:
As
saltCount
is only listening on an instance ofsaltShaker
, we can leave it bound once someone readsthis.saltCount
.The following should work:
I think this would be REALLY nice for getters and async getters:
Obviously, there would still be corner cases like in
saltShaker
above. But overall, I think these sorts of behaviors would act more like people suspect.Thoughts?
The text was updated successfully, but these errors were encountered: