Description

Returns a promise that is fulfilled when the provided resolve or reject function is called. Any errors thrown in the constructor callback will be implicitly passed to reject(error).

Signature


calli.promise(function(resolve,reject))
Parameter Description
resolve(obj) Function to call when a thenable or object fulfils this promise
reject(error) Function to call when this promise is rejected. For consistency and debugging (eg stack traces), obj should be an instanceof Error.

Example


calli.promise(function(callback){
    google.load('visualization', '1.0', {
        packages: ['core'],
        callback: callback
    });
}).then(function(){
    new google.visualization.ChartWrapper(options).draw();
}).then(undefined, calli.error);