@studiokeywi/banjo - v0.0.1
    Preparing search index...

    Interface Watcher

    A Watcher is a configurable system to run callback functions. They are primarily designed to work with intermittent or otherwise limited duration activities.

    Watchers use a combination of setInterval and setTimeout to control the frequency and time span in which they operate. Watchers provide a chainable syntax as well as the ability to pass optional configuration objects to allow adjustments to be made over time.

    Timeline of Watcher behaviors:

    • .start()
    • .begin()
    • Loop: Every .every() ms for .for() ms, or until .stop():
      • .unless(), .while()
      • .do()
      • .until(), .because()
    • .end()
    interface Watcher {
        get running(): boolean;
        because(becauseThis: CheckFunction, cfg?: BecauseConfig): Watcher;
        begin(onBegin: NoOp, cfg?: BeginConfig): Watcher;
        configure(cfg?: WatcherConfig): Watcher;
        do(doThis: RunFunction, cfg?: DoConfig): Watcher;
        end(onEnd: NoOp, cfg?: EndConfig): Watcher;
        every(doEvery: Chrono, cfg?: EveryConfig): Watcher;
        for(doFor: Chrono, cfg?: ForConfig): Watcher;
        start(): undefined | true;
        stop(): undefined | true;
        unless(unlessThis: CheckFunction, cfg?: UnlessConfig): Watcher;
        until(untilThis: CheckFunction, cfg?: UntilConfig): Watcher;
        while(whileThis: CheckFunction, cfg?: WhileConfig): Watcher;
    }
    Index

    Accessors

    • get running(): boolean

      Whether the Watcher is currently active

      Returns boolean

    Methods

    • Starts the current set of configured behaviors

      Returns undefined | true

      True if the Watcher was started

    • Stops the current set of configured behaviors

      Returns undefined | true

      True if the Watcher was stopped