Function.prototype.promise = function () { /* Arguments: condition to be met before running polling interval arguments for the function */ var __method=this, oArgs=arguments, args=[],i,__cond=oArgs[0],__intv=oArgs[1]; for (i=2; i