diff options
author | Yingchen Xue <yingchenxue@qq.com> | 2018-06-05 16:10:27 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-06-05 10:10:27 +0200 |
commit | 78124cd45f5b5efe1f06e82554ff09273b75b050 (patch) | |
tree | 646f8d233b5827d4b790d4f97ddce977eb1870c5 /timers.ts | |
parent | 8094c7421b50d3cbbc0eace6d376d7ed31b3cfa1 (diff) |
Rename sendMsg to pubInternal (#136)
Diffstat (limited to 'timers.ts')
-rw-r--r-- | timers.ts | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,7 +1,7 @@ // Copyright 2018 Ryan Dahl <ry@tinyclouds.org> // All rights reserved. MIT License. import { main as pb } from "./msg.pb"; -import * as dispatch from "./dispatch"; +import { pubInternal, sub } from "./dispatch"; import { assert } from "./util"; let nextTimerId = 1; @@ -21,7 +21,7 @@ interface Timer { const timers = new Map<number, Timer>(); export function initTimers() { - dispatch.sub("timers", onMessage); + sub("timers", onMessage); } function onMessage(payload: Uint8Array) { @@ -54,7 +54,7 @@ function setTimer( cb }; timers.set(timer.id, timer); - dispatch.sendMsg("timers", { + pubInternal("timers", { command: pb.Msg.Command.TIMER_START, timerStartId: timer.id, timerStartInterval: timer.interval, @@ -82,7 +82,7 @@ export function setInterval( } export function clearTimer(id: number) { - dispatch.sendMsg("timers", { + pubInternal("timers", { command: pb.Msg.Command.TIMER_CLEAR, timerClearId: id }); |