Skip to content
Mark-Simulacrum edited this page Dec 23, 2014 · 5 revisions

spromise Build Status

spromise (Small Promise), is an implementation of the promise A+ spec. It is designed to be lightweight, performant, and per spec, interoperable with other promise implementations such as jQuery's deferred.

Table of Contents

Install

bower

$ bower install spromise

npm

$ npm install spromise

Downloads

General purpose UMD (Browser, Node):

For inline inclusion in your AMD code:

Build

Run the following command in the terminal:

$ npm install

Tests

Unit tests

Run the following commands in the terminal:

$ npm install
$ grunt test

Compliance unit tests:

Run the following commands in the terminal:

$ npm install
$ npm test

Compliance notes

With the exception of 2.2.5, which states that onFullfilled/onRejected must not be called with "this", all tests for compliance pass.
The reason spromise was left non compliant for this particular item is to faithfully handle "context" configured in jQuery ajax requests.

  • NOTE: The spec makes use of fulfilled, which is the exact same thing as resolved in spromise. The different names exists because it seems more consistent that if you call resolve to transition a promise to the resolved state, that the state is resolved and not fulfilled. In spromise's documention both are used simply for better readability.
Test results:
  868 passing (14s)
  4 failing

  1) 2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value). strict mode fulfilled:
     Error: timeout of 200ms exceeded
      at null. (/Users/mcastillo/Projects/promises-tests/node_modules/mocha/lib/runnable.js:165:14)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  2) 2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value). strict mode rejected:
     Error: timeout of 200ms exceeded
      at null. (/Users/mcastillo/Projects/promises-tests/node_modules/mocha/lib/runnable.js:165:14)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  3) 2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value). sloppy mode fulfilled:
     Error: timeout of 200ms exceeded
      at null. (/Users/mcastillo/Projects/promises-tests/node_modules/mocha/lib/runnable.js:165:14)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

  4) 2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value). sloppy mode rejected:
     Error: timeout of 200ms exceeded
      at null. (/Users/mcastillo/Projects/promises-tests/node_modules/mocha/lib/runnable.js:165:14)
      at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

Clone this wiki locally