Author: jruchaud Date: 2015-05-22 15:07:51 +0000 (Fri, 22 May 2015) New Revision: 1449 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1449 Log: Detection no use wit but it is started Added: wit/js/services/NoTimerService.js Added: wit/js/services/NoTimerService.js =================================================================== --- wit/js/services/NoTimerService.js (rev 0) +++ wit/js/services/NoTimerService.js 2015-05-22 15:07:51 UTC (rev 1449) @@ -0,0 +1,26 @@ +"use strict"; + +var moment = require("moment"); +var notTimerTimer; + +exports.detect = function() { + var noTimerConfig = scope.config.getNoTimer(); + if (noTimerConfig) { + + var duration = moment.duration(noTimerConfig, "m"); + + notTimerTimer = setTimeout( + function() { + global.window.alert("Do you need wit ?"); + exports.detect(); + + }, duration.asMilliseconds()); + } +}; + +scope.timer.subscribeTimeChanged(function() { + clearTimeout(notTimerTimer); + if (!scope.timer.time) { + exports.detect(); + } +});
participants (1)
-
jruchaud@users.nuiton.org