Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Clock

计时器

summary

记录一段或多段时间间隔

example
 const c = new Clock // or Clock.create()
 
 c.tick()
 setTimeout(() => {
   c.tick()
 }, 1000)

 setTimeout(() => {
  console.log('time:', c.nextTick())
 }, 2000)
 

Hierarchy

  • Clock

Index

Constructors

constructor

Properties

Private _currentTick

_currentTick: number = 0

Private _times

_times: number[] = ...

Static END

END: string = 'END'

Methods

_getTimes

  • _getTimes(): number[]

clean

  • clean(): void

currentTick

  • currentTick(): number

firstTick

  • firstTick(): number

getTick

  • getTick(start: number, end: number): number

lastTick

  • lastTick(): number

len

  • len(): number

nextTick

  • nextTick(): string | number

resetTick

  • resetTick(): void

tick

  • tick(): void

Static create

Generated using TypeDoc