Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Module "timer" | |
| 6 // | |
| 7 // This module provides basic setTimeout, setInterval support. The reason to | |
| 8 // define this module to forward calls to setTimeout, setInterval exposed by | |
| 9 // the browser. Mojo JS bindings are currently loaded using gin | |
| 10 // and setTimeout, setInterval is not always available. When the Mojo JS | |
|
Eugene But (OOO till 7-30)
2017/03/20 20:53:46
If this is a workaround, could you please add "TOD
wangjimmy
2017/03/21 16:53:37
Done.
| |
| 11 // bindings move away from gin, this module could be removed. | |
| 12 | |
| 13 define("timer", [], function() { | |
| 14 /** | |
| 15 * Logs a message to the console. | |
|
Eugene But (OOO till 7-30)
2017/03/20 20:53:46
Please update the comment to reflect what this fun
wangjimmy
2017/03/21 16:53:37
Done.
| |
| 16 * @param {string} message to log. | |
| 17 */ | |
| 18 function createOneShot(delay, callback) { | |
| 19 setTimeout(callback, delay); | |
| 20 } | |
| 21 | |
| 22 function createRepeating(delay, callback) { | |
|
Eugene But (OOO till 7-30)
2017/03/20 20:53:46
Please add a comment
wangjimmy
2017/03/21 16:53:37
Done.
| |
| 23 setInterval(callback, delay); | |
| 24 } | |
| 25 | |
| 26 var exports = {}; | |
| 27 exports.createOneShot = createOneShot; | |
| 28 exports.createRepeating = createRepeating; | |
| 29 return exports; | |
| 30 }); | |
| OLD | NEW |