Skip to content

Instantly share code, notes, and snippets.

@u3k
u3k / promises.md
Last active December 27, 2015 20:59 — forked from calvinmetcalf/promises.md
/*

#Promises

This file is both legal JavaScript and markdown, so if there are a few quirks like that open comment up there, that is why.

This code is from a [promise library called 'lie'][lie]. You can install it from npm with npm install lie.

The intent of this code is to implement promises in a straightforward way that is as close to the spec as possible while also being readable and performance. The version of promises that ended up being settled on is (as of 10/27/13) a simple constructor which takes as its sole argument a function with 2 arguments, 'fulfill' and 'reject'. Gone are the earlier notions of promises and deferred objects (which is good a I kept trying to spell deferred with 2 Fs and 1 R).