comparison src/implab/safe.js @ 10:8705103f074f

Слияние
author cin
date Mon, 21 Aug 2017 18:03:00 +0300
parents f0035923ff3e
children 3d4abbce4afc
comparison
equal deleted inserted replaced
9:37e9e6bbe87a 10:8705103f074f
141 /** Wraps the specified function to emulate an asynchronous execution. 141 /** Wraps the specified function to emulate an asynchronous execution.
142 * @param{Object} thisArg [Optional] Object which will be passed as 'this' to the function. 142 * @param{Object} thisArg [Optional] Object which will be passed as 'this' to the function.
143 * @param{Function|String} fn [Required] Function wich will be wrapped. 143 * @param{Function|String} fn [Required] Function wich will be wrapped.
144 */ 144 */
145 async: function (fn, thisArg) { 145 async: function (fn, thisArg) {
146 if (arguments.length == 2) 146 if (arguments.length == 2 && !(fn instanceof Function))
147 fn = thisArg[fn]; 147 fn = thisArg[fn];
148 148
149 if (fn == null) 149 if (fn == null)
150 throw new Error("The function must be specified"); 150 throw new Error("The function must be specified");
151 151