tts.DeferredPromise = function() { var _resolve = null; var _reject = null; this.promise = new Promise(function(resolve, reject) { _resolve = resolve; _reject = reject; }); this.then = function() { return this.promise.then(...arguments); } this.catch = function() { return this.promise.catch(...arguments); } this.resolve = function() { _resolve(...arguments); } this.reject = function() { _reject(...arguments); } };