docs: function Promise(resolver, stateManager) {
      stateManager = stateManager || new StateManager();
      var target = this;
  
      target.then = function(onResolved, onRejected) {
        return stateManager.then(onResolved, onRejected);
      };
  
      target.resolve = function() {
        stateManager.transition(states.resolved, arguments, this);
        return target;
      };
  
      target.reject = function() {
        stateManager.transition(states.rejected, arguments, this);
        return target;
      };
  
      // Read only access point for the promise.
      target.promise = {
        then   : target.then,
        always : target.always,
        done   : target.done,
        catch  : target.fail,
        fail   : target.fail,
        notify : target.notify,
        state  : target.state,
        constructor : Promise // Helper to detect spromise instances
      };
  
      target.promise.promise = target.promise;
      target.then.stateManager = stateManager;
  
      if (resolver) {
        resolver.call(target, target.resolve, target.reject);
      }
    }