A timer is an attribute of a reactor which periodically (or just once) creates a timer event. A timer has an offset and a period. Upon initialization the timer will schedule an event at the given offset from starting wall clock time. Whenever this timer's event comes off the event queue, it will reschedule the event at the current logical time + period in the future. A 0 period indicates the timer's event is a one-off and should not be rescheduled.

Hierarchy (view full)

Implements

Constructors

  • Timer constructor.

    Parameters

    • __container__: Reactor

      The reactor this timer is attached to.

    • offset: 0 | TimeValue

      The interval between the start of execution and the first timer event. Cannot be negative.

    • period: 0 | TimeValue

      The interval between rescheduled timer events. If 0, will not reschedule. Cannot be negative.

    Returns Timer

Properties

_key: symbol = ...

A symbol that identifies this component, and it also used to selectively grant access to its privileged functions.

manager: (Anonymous class)<Tag> = ...
offset: TimeValue
period: TimeValue
reactions: Set<Reaction<Variable[]>> = ...

Reactions to trigger.

runtime: Runtime
tag: undefined | Tag
value: undefined | Tag = undefined
pathSeparator: string = "."

Methods

  • Return a string that identifies this component within its container. If no such string was found, return the name of the constructor.

    Returns string

  • Confirm whether or not this component is contained by the given reactor.

    Parameters

    • reactor: Reactor

      The presumptive container of this component.

    Returns boolean

  • Confirm whether or not this component is contained by the container of the given reactor.

    Parameters

    • reactor: Reactor

      The container presumptive container of the container of this component.

    Returns boolean

  • Report whether this component has been registered with its container or not. In principle, all components should have a container, but at the time of their construction there is a brief period where they are not. This is the only moment that a component is allowed register with its container.

    Returns boolean

  • Request the container to pass down its runtime object to this component. This function is to be called once and only once upon the construction of an object that subclasses Component. If it is called more than once a runtime error results.

    Returns void

  • Request the manager of this trigger. The request will only be honored if the correct key is given. Each component has a unique symbol (a key) that is handed to the owner upon instantiation of the component. If the wrong key is supplied, return undefined.

    Parameters

    • key: undefined | symbol

      The private key embedded in this trigger.

    Returns TriggerManager

  • Returns true if this action was scheduled for the current logical time. This result is not affected by whether it has a value.

    Returns boolean

  • Returns a string representation of an object.

    Returns string

  • Update the current value of this timer in accordance with the given event, and trigger any reactions that list this timer as their trigger.

    Parameters

    Returns void

  • Given a component and its container (the global object if the component is an App), return the key of the entry that matches the component.

    Parameters

    • component: Component

      a component of which the object is assumed to be its container

    • object: object

      the assumed container of the component

    Returns string

    the key of the entry that matches the component

  • Given a port and its containing reactor, return the key of the entry that matches a multiport found in the reactor that matches the port.

    Parameters

    • port: Component

      a port that is assumed to be a constituent of a multiport declared on the given reactor

    • reactor: Reactor

      a reactor that is assumed to have a multiport of which one of the constituents is the given port

    Returns string

    an identifier for the port based on its location in a matching multiport