Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Nancy {
- constructor(executor) {
- ...
- const laterCalls = [];
- const callLater = getMember => callback => new Nancy(resolve => laterCalls.push(() => resolve(getMember()(callback))));
- const members = {
- ...
- [states.pending]: {
- ...
- then: callLater(() => this.then),
- catch: callLater(() => this.catch)
- }
- };
- ...
- const apply = (value, state) => {
- ...
- for (const laterCall of laterCalls) {
- laterCall();
- }
- };
- ...
- }
- ...
- }
Add Comment
Please, Sign In to add comment