summaryrefslogtreecommitdiff
path: root/js/timers.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/timers.ts')
-rw-r--r--js/timers.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/js/timers.ts b/js/timers.ts
index 42be96d91..03badfd46 100644
--- a/js/timers.ts
+++ b/js/timers.ts
@@ -19,6 +19,15 @@ interface Timer {
delay: number; // milliseconds
}
+export function setGlobalTimeout(timeout: number) {
+ const builder = new flatbuffers.Builder();
+ fbs.SetTimeout.startSetTimeout(builder);
+ fbs.SetTimeout.addTimeout(builder, timeout);
+ const msg = fbs.SetTimeout.endSetTimeout(builder);
+ const res = sendSync(builder, fbs.Any.SetTimeout, msg);
+ assert(res == null);
+}
+
function startTimer(
id: number,
cb: TimerCallback,