Promise decorator built on top of rsvp.js.
Confetti is a promise decorator built on top of rsvp.js. With Confetti, you can easily define promise constructors that have custom functions attached to the constructor's prototype. The custom functions get wrapped in a way that allows them to be called within the framework of promises. It's quite cool.
The documentation for this project is lacking and I plan on adding much more thorough documentation as soon as I can. Until then, if you have any questions about Confetti, open up an issue or contact me through whatever means works for you.
$ npm install confetti
var confetti = require'confetti';
Returns a promise constructor with each function contained in
functions added to its prototype. Before being added to the constructor's prototype, each function contained in
functions will be wrapped to work within the promise framework.
Confetti works with both sync and async functions. In order to determine whether or not the function being dealt with is sync or async, Confetti relies on the function's signature. If the function's signature contains 1 more parameter then it's being called with, Confetti will assume the function is asynchronous and that the missing argument is the callback function.
Note that Confetti is very picky about function signatures. Bad things will happen when the number of arguments a function is called with doesn't match up with the number of formal parameters. The one exception to this rule is for async functions. With async functions, you should omit the callback argument when calling them.
var confetti = require'confetti';var Promise = confettidefinereturn 'Sync functions are ' + adjective + '!';processnextTickcbnull 'Async functions are ' + adjective + '!';;;var promise = ;promiseasync'hip'value console.logresult;sync'old school'value console.logresult;.error console.log'error is bad'; ;promiseresolve;
Async functions are hip!Sync functions are old school!
$ cd confetti$ npm test
Found a bug? Create an issue on GitHub.
For transparency and insight into the release cycle, releases will be numbered with the follow format:
And constructed with the following guidelines:
For more information on semantic versioning, please visit http://semver.org/.
Copyright (c) 2012 Jake Harding
Licensed under the MIT License.