Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Schedule

A coroutine schedule.

Coroutines are added to a schedule with add and all scheduled coroutines are advanced with tick.

Hierarchy

  • Schedule

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private coroutines

coroutines: Coroutine[] = ...

Readonly name

name: string

For debugging

Methods

add

  • Schedules a coroutine for evaluation.

    Future calls to tick will run coro up to its next yield until it is completed.

    As a convenience if coro is a generator function and not a generator, it will be evaluated to produce a generator.

    function* coroutineFunction() { ... }
    let schedule = new Schedule()
    schedule.add(coroutineFunction()) // this works
    schedule.add(coroutineFunction)   // so does this
    

    Parameters

    Returns Coroutine

remove

removeAll

  • removeAll(): void

tick

  • tick(): void
  • Advances all scheduled coroutines once.

    Each coroutine added with add will run up to its next yield statement. Finished coroutines are removed from the collection.

    Returns void

Generated using TypeDoc