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

x/easyts/time/mod.ts>Ticker

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

A Ticker containing a channel that will send the current time on the channel after each tick. The period of the ticks is specified by the duration argument. The ticker will adjust the time interval or drop ticks to make up for slow receivers. The duration d must be greater than zero; if not, NewTicker will throw exception

Constructors

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

Properties

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

The channel on which the ticks are delivered.

Methods

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

Reset stops a ticker and resets its period to the specified duration.

stop(): void

Stop turns off a ticker. After Stop, no more ticks will be sent.