Author: ygrego Date: 2015-04-01 09:08:47 +0000 (Wed, 01 Apr 2015) New Revision: 1008 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1008 Log: A function is writed for call of "setTimeout" in method "init". In method "cancel", the property "promise" and "timer" become equals to null. Modified: oipf/js/utils/Timeout.js Modified: oipf/js/utils/Timeout.js =================================================================== --- oipf/js/utils/Timeout.js 2015-04-01 09:04:26 UTC (rev 1007) +++ oipf/js/utils/Timeout.js 2015-04-01 09:08:47 UTC (rev 1008) @@ -11,7 +11,9 @@ init: function(time) { var self = this; this.promise = new Promise(function(resolve, reject) { - self.timerId = setTimeout(resolve, time); + self.timerId = setTimeout(function() { + resolve(); + }, time ||Â 0); }); }, @@ -27,6 +29,8 @@ cancel: function() { clearTimeout(this.timerId); + this.timerId = null; + this.promise = null; } });