intro

You'll fin here the Promise API. If you haven't done yet, you should read - at least in diagonal - the "fundamentals" section.

If you searching about Deferred, or when( ... ) and all( ... ), there they are.

API

base
.done( callback )
inject success in callback.
.fail( callback )
inject error in callback.
.then( doneCB, failCB )
if success : inject success in doneCB. else : inject error in failCB.
.always( callback )
inject success (if any) and error (if any) in callback.
logging
.log()
log current success or error.
.elog()
log success.
.slog()
log error.
.clog( key )
log context.
memento
.toState(key, value)
store value or success in current chain's state.
.fromState(key)
read value in chain's state and inject it in chain.
context
.contextualise()
associate new context to current chain.
.toContext(key, value)
store value or success in chain's context.
.fromContext()
read value in chain's context, and inject it in chain.
OCM
.modes(key, value)
set (in chain's context) 'key' modes to value.
identities
.log()
log current success or error.
.elog()
log success.
.slog()
log error.
.clog( key )
log context.
misc
.equal( arg )
test strict equality (deepEqual) between success and arg.
.delay( ms )
delay the execution of the rest of the chain.
.when(...)
...
.branches( callback )
create brancher and inject it in callback.

Base

Fundamentals methods of Promises.

.done( function callback(success){} )

callback
The success handler.
the current chain handler.
deep.when("hello").done(function (s){ deep.log(s); });

.fail( function callback(error){} )

callback
The error handler.
the current chain handler.
deep.when(new Error("oups!")).fail(function(e){ deep.log(e); });

.then(function(error){})

callback
The error handler.
the current chain handler.
deep.when(new Error("oups!")).fail(function(e){ deep.log(e); });

.always(function(success, error){})

callback
The error handler.
the current chain handler.

will always be executed.

deep.when(new Error("oups!")).fail(function(e){ deep.log(e); });

Logging familly.

.log()

will always be executed.

if you provide no arguments : will log current state. (success or error) if you provide a list of arguments (i.e. .log(arg1, "hello", myObject, 12, ...)), it will print them as deep log would do.
deep.when(true)
.log("hello", "john", ":");
It does not modifiy promise state.

.slog( ... )

same thing as .log() above. But log current context in place of promise state. it does not modifiy promise state.

.elog( ... )

same thing as .log() above. But log current context in place of promise state. it does not modifiy promise state.

.clog( key )

same thing as .log() above. But log current context in place of promise state. it does not modifiy promise state.

Mementos

.toState( key, value )

.fromState( key )

Context

.contextualise()

.toContext(key, value)

.fromContext(key)

OCM

.modes(...)

Identities

Misc

.equal( obj )

Executed only if promise is in success state. Test success struct equality to obj. Useful for testcasing. If not equal, it inject a PreconditionFailed error (status 412) in promise, with equality report. If equal : it does not modifiy promise state.

.delay( ms )

executed only in success state. Add an artifical delay in chain execution. useful for test and debug.

.when( something )

Not exactly the same thing as deep.when( something ) that return a promise that waiting 'something' (you start a promise as this), when you use it in an existant promise chain, it will wait 'something' and take it result as current state before continuing.
deep.when( something )
.done(function( somethingResult ))
.when( anotherthing )
.done(function( anotherthingResult ){
	...
});