Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 581 Bytes

tick.decorator.md

File metadata and controls

33 lines (26 loc) · 581 Bytes

#OnTick decorator

The examples bellow are the same

class T {
  constructor() {
    setInterval(this.tick1.bind(this), 100)
    setTick(this.tick2.bind(this))
  }

  private tick1(...args: unknown[]): void {}

  private tick2(...args: unknown[]): void {}
}
import { Controller } from "./controller.decorator";
import { OnTick } from "./tick.decorator";

@Controller('T')
class T {
  // interval is optional, default 0
  @OnTick(100)
  private tick1(...args: unknown[]): void {
  }

  @OnTick()
  private tick2(...args: unknown[]): void {
  }
}