Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/easyts/time/time.ts>Timer

js library written with ts, use select and chan like golang in js.
Latest
class Timer
import { Timer } from "https://deno.land/x/easyts@0.1.3/time/time.ts";

Timer that will send the current time on its channel after at least duration millisecond.

Constructors

new
Timer(ms: number)
new
Timer(ms: number, callback?: ValueCallback<Date>)

Properties

private
c_: Chan<Date> | undefined
private
t_: number | undefined
readonly
c: ReadChannel<Date>

When the Timer expires, the current time will be sent on c

Methods

private
_send(val: Date)
private
_start(ms: number)
reset(ms: number): boolean

Reset changes the timer to expire after duration millisecond.

stop(): boolean

Stop prevents the Timer from firing.