A Future represents a value that is going to be computed in the future, asynchronously.
Constructs a new Future
optionally provide the "this" argument to pass to listeners when this Future is fulfilled.
Binds a this argument to the future which will be passed to listeners when this Future is called.
returns this future
Cancels this future, causing it to go into the Future.CANCELLED state.
the optional value that will be passed to this futures cancel listeners
returns this Future
Fails this future, with the given reason. Users should never call this method directly.
returns this future
Fulfills this future which marks the future as being successfully completed.
an optional value that was created by the future.
Register a function to be called if this Future completes. The function will be called with the value of the future as the argument.
Note this API does not currently support removing the listener.
this future
Register a function to be called if this Future fails.
Note this API does not currently support removing the listener.
this future
Register a function to be called as progress events occur on this Future. The function will be called with the value of the progress as the argument.
Note this API does not currently support removing the listener.
this future
Progresses this future, with the given arguments. Users should never call this method directly.
optional value that will be passed this future's progress listeners
returns this future
Registers a set of listeners that are called as this future progresses. And returns a new future that is fulfilled by the return value of the oncomplete handler. In this way, Futures can be chained.
the function to call when this Future is complete.
the function to call if this Future encounters an error. This will only be called one or zero times.
the function to call as this Future progresses. This is not guaranteed to be called.
thinkmap.async.later(function() { return 5; },2000)
.then(function(x) { return v + 2; })
.then(function(v) { alert(v); });
Add a listener to this EventSource
the name of the event to listen for
the callback to add
this eventsource
Dispatch an event from this EventSource, supplying arguments to the listeners via an Array, rather than var-args.
the name of the event to dispatch
this EventSource
Dispatch an event from this EventSource
the name of the event to dispatch
optional arguments sent to the event listeners
this EventSource
Fire an event from this EventSource
the name of the event to dispatch
optional arguments sent to the event listeners
this EventSource
Remove a listener from this EventSource
the name of the event to remove the listener for
the callback to remove
this eventsource
Add a listener to this EventSource
the name of the event to listen for
the callback
this eventsource
Add a listener to this EventSource, which will be called at most once and will be removed the first time the given event fires.
the name of the event to listen for
the callback to add
this eventsource
Remove a listener from this EventSource
the name of the event to remove the listener for
the callback to remove
this eventsource
fired when this future completes. The arguments to this event are the arguments used to fulfill (complete) this future
fired when this future is cancelled. The arguments to this event are the arguments passed to the cancel method of this future
fired when this future encounters an error. The arguments to this event are the error which caused this future from being unable to complete.
fired when this future has been notified of progress. The arguments to this event are the arguments passed to this futures progress method.