* Call f in a future turn, with the supplied args, and return a promise * for the result. * @param {function} f * @returns {Promise}
(f /*, args... */)
| 119 | * @returns {Promise} |
| 120 | */ |
| 121 | function attempt(f /*, args... */) { |
| 122 | /*jshint validthis:true */ |
| 123 | for(var i=0, l=arguments.length-1, a=new Array(l); i<l; ++i) { |
| 124 | a[i] = arguments[i+1]; |
| 125 | } |
| 126 | return apply(f, this, a); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Creates a {promise, resolver} pair, either or both of which |