Skip to content

Instantly share code, notes, and snippets.

@briancavalier
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briancavalier/9940889 to your computer and use it in GitHub Desktop.
Save briancavalier/9940889 to your computer and use it in GitHub Desktop.
// Before fold-related changes
Handler.prototype.when(resolve, notify, context, receiver, onFulfill, onReject, onProgress);

Params:

  • resolve - continuation function called by the promise machinery (technically by FulfilledHandler or RejectedHandler) with the result of either onFulfilled or onRejected. Sends values or errors on to the next handler in the chain.
  • notify - continuation function called with the result of onProgress. Sends progress values on to the next handler in the chain.
  • context - thisArg that will be used when calling resolve and/or notify
  • receiver - thisArg that will be used when calling onFulfill, onReject, or onProgress
  • onFulfill - function to call with the fulfillment value of the handler's associated promise. May return either a value or a promise, or may throw.
  • onReject - function to call with the fulfillment value of the handler's associated promise. May return a either a value or a promise, or may throw.
  • onProgress - function to call with progress update values sent to the handler's associated promise
// After fold-related changes
Handler.prototype.when(resolve, notify, context, receiver, arg, onFulfill, onReject, onProgress);

Additional param:

  • arg - (any type) additional argument to pass through to be provided to onFulfill, if not nil.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment