tc39 / proposal-eventual-send

TC39 Eventual Send proposal
44 stars 6 forks source link

Add a .then() (and indirectly E.when() through it) detection trap #25

Open zarutian opened 2 years ago

zarutian commented 2 years ago

The proposed trap to add to the two eventual trap handlers:

...
  // @param {Object} target
  // @return {void}
  onThen: (target) => {
  }
...

This will enable CapTP and other such to only request to know the actual resulution/rejection of an eventual promise iff there is local code that wants to know. See this ocapn issue for more.

Feel free to suggest another name for it.

(ps. Similiar trap for E.there(promise, whatever) would be onThere: (target, whatever) => { return new Promise.delegate(...); } but that is for later date)