ppp
v0.8.2 ppp promise promises promises-a promises-aplus async flow control browser node and 3 more...
PPP
A slim promise implementation.
- Status:
UNSTABLE
- Versions0.8.x
are preview releases, with possible API breaking changes between patch versions. I look forward to nailing down the API for version1.0.x
.
Goals
- to provide a simple, no-frills, compliant promise implementation.
- to limit the use of closure scope / function binding in an effort to lower memory thrashing in projects that make extensive promise use.
- to provide a measure of debug-ability despite asynchronous execution.
Usage
npm install ppp
var ppp = require('ppp');
var defer = ppp.Promise.defer();
defer.promise.then(function onSuccess(res) {
console.log(res);
});
defer.resolve('hello world');
As a native polyfill
(function (global) {
if (!global.Promise) {
global.Promise = require('ppp').Promise;
}
})(this);
Resources
Benchmarks
grunt benchmark
# Memory:All
[email protected]: 1.65 MB ±0.08 MB
[email protected]: 1.96 MB ±0.15 MB
[email protected]: 6.66 MB ±1.05 MB
[email protected]: 3.65 MB ±0.38 MB
# Memory:Then
[email protected]: 0.63 MB ±0.04 MB
[email protected]: 1.31 MB ±0.13 MB
[email protected]: 3.52 MB ±0.49 MB
[email protected]: 1.37 MB ±0.15 MB
# Cpu:All
[email protected]: 461 ops/sec ±1.18 %
[email protected]: 419 ops/sec ±1.44 %
[email protected]: 142 ops/sec ±3.94 %
[email protected]: 426 ops/sec ±1.10 %
# Cpu:Then
[email protected]: 486 ops/sec ±1.39 %
[email protected]: 417 ops/sec ±2.03 %
[email protected]: 191 ops/sec ±3.40 %
[email protected]: 459 ops/sec ±1.51 %
test/benchmark.html
(Chrome)
# Cpu:All
ppp: 156 ops/sec ±0.61 %
bluebird: 78.70 ops/sec ±0.48 %
q: 134 ops/sec ±4.08 %
vow: 155 ops/sec ±0.77 %
# Cpu:Then
ppp: 158 ops/sec ±0.61 %
bluebird: 76.47 ops/sec ±1.20 %
q: 159 ops/sec ±2.70 %
vow: 156 ops/sec ±0.37 %
npm i [email protected]
Metadata
- MIT
- Whatever
- David Braden V, ~3o~ph
- released 6/22/2015