Guest User

Untitled

a guest
Feb 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. class Nancy {
  2. constructor(executor) {
  3. ...
  4. const laterCalls = [];
  5. const callLater = getMember => callback => new Nancy(resolve => laterCalls.push(() => resolve(getMember()(callback))));
  6. const members = {
  7. ...
  8. [states.pending]: {
  9. ...
  10. then: callLater(() => this.then),
  11. catch: callLater(() => this.catch)
  12. }
  13. };
  14. ...
  15. const apply = (value, state) => {
  16. ...
  17. for (const laterCall of laterCalls) {
  18. laterCall();
  19. }
  20. };
  21. ...
  22. }
  23. ...
  24. }
Add Comment
Please, Sign In to add comment