summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timers.go10
-rw-r--r--timers.ts18
2 files changed, 14 insertions, 14 deletions
diff --git a/timers.go b/timers.go
index dd262e7d9..76b66cc63 100644
--- a/timers.go
+++ b/timers.go
@@ -12,7 +12,7 @@ type Timer struct {
Done bool
Cleared bool
Interval bool
- Duration int32 // In milliseconds
+ Delay int32 // In milliseconds
}
var timers = make(map[int32]*Timer)
@@ -28,11 +28,11 @@ func InitTimers() {
Id: id,
Done: false,
Interval: msg.TimerStartInterval,
- Duration: msg.TimerStartDuration,
+ Delay: msg.TimerStartDelay,
Cleared: false,
}
- if t.Duration < 10 {
- t.Duration = 10
+ if t.Delay < 10 {
+ t.Delay = 10
}
t.StartTimer()
timers[id] = t
@@ -62,7 +62,7 @@ func (t *Timer) StartTimer() {
go func() {
defer t.Clear()
for {
- time.Sleep(time.Duration(t.Duration) * time.Millisecond)
+ time.Sleep(time.Duration(t.Delay) * time.Millisecond)
if !t.Interval {
t.Done = true
}
diff --git a/timers.ts b/timers.ts
index d142ba76b..6fa0e7a43 100644
--- a/timers.ts
+++ b/timers.ts
@@ -15,7 +15,7 @@ interface Timer {
interval: boolean;
// tslint:disable-next-line:no-any
args: any[];
- duration: number; // milliseconds
+ delay: number; // milliseconds
}
const timers = new Map<number, Timer>();
@@ -41,7 +41,7 @@ function onMessage(payload: Uint8Array) {
function setTimer(
cb: TimerCallback,
- duration: number,
+ delay: number,
interval: boolean,
// tslint:disable-next-line:no-any
args: any[]
@@ -49,7 +49,7 @@ function setTimer(
const timer = {
id: nextTimerId++,
interval,
- duration,
+ delay,
args,
cb
};
@@ -57,28 +57,28 @@ function setTimer(
dispatch.sendMsg("timers", {
command: pb.Msg.Command.TIMER_START,
timerStartId: timer.id,
- timerStartInterval: interval,
- timerStartDuration: duration
+ timerStartInterval: timer.interval,
+ timerStartDelay: timer.delay
});
return timer.id;
}
export function setTimeout(
cb: TimerCallback,
- duration: number,
+ delay: number,
// tslint:disable-next-line:no-any
...args: any[]
): number {
- return setTimer(cb, duration, false, args);
+ return setTimer(cb, delay, false, args);
}
export function setInterval(
cb: TimerCallback,
- repeat: number,
+ delay: number,
// tslint:disable-next-line:no-any
...args: any[]
): number {
- return setTimer(cb, repeat, true, args);
+ return setTimer(cb, delay, true, args);
}
export function clearTimer(id: number) {