Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ChannelWithGUI

It represents a channel of Automaton. It has even more pretty APIs than raw Channel yay It has even more pretty APIs yay

param

Parent automaton

param

Data of the channel

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected __automaton

__automaton: AutomatonWithGUI

The parent automaton.

Protected Optional __eventListeners

__eventListeners: Map<keyof ChannelWithGUIEvents, EventListener<any>[]>

Protected __head

__head: number

The index of __items it should evaluate next.

Protected __items

__items: Array<ChannelItemWithGUI>

List of channel items.

Protected __listeners

__listeners: Array<(event: ChannelUpdateEvent) => void>

An array of listeners.

Private __shouldReset

__shouldReset: boolean = false

Whether it should reset itself in next update call or not.

Protected __time

__time: number

The time that was used for the calculation of [[__lastValue]].

Protected __value

__value: number

A cache of last calculated value.

Accessors

currentTime

  • get currentTime(): number
  • The time that was used for the calculation of [[__lastValue]].

    Returns number

currentValue

  • get currentValue(): number
  • A cache of last calculated value.

    Returns number

items

length

  • get length(): number

status

Methods

Protected __clearStatus

  • __clearStatus(): void

Protected __deleteStatus

Protected __emit

  • __emit<TType>(...__namedParameters: [undefined | TEvents[TType]]): void

Private __getItemIndexById

  • __getItemIndexById(id: string): number
  • Search for item that has given id then return index of it. If it couldn't find the item, it will throw an error instead.

    Parameters

    • id: string

      Id of item you want to grab

    Returns number

    The index of the item

Private __serializeItems

  • __serializeItems(): SerializedChannelItem[]

Protected __setStatus

Private __sortItems

  • __sortItems(): void

Private __tryGetItemIndexById

  • __tryGetItemIndexById(id: string): number

Private __watchStatus

  • __watchStatus(procedure: () => void): void
  • Watch for status changes. Execute given procedure immediately. If the procedure changes its status, emit an event.

    Parameters

    • procedure: () => void

      A procedure that might change its status

        • (): void
        • Returns void

    Returns void

changeCurveAmp

  • changeCurveAmp(id: string, amp: number): void

changeCurveSpeedAndOffset

  • changeCurveSpeedAndOffset(id: string, speed: number, offset: number): void

changeItemReset

  • changeItemReset(id: string, reset: boolean): void

changeItemValue

  • changeItemValue(id: string, value: number): void

consume

  • consume(time: number): [time: number, update: () => void][]
  • This method is intended to be used by [[Automaton.update]]. Consume and return items.

    Parameters

    • time: number

      The current time of the parent Automaton

    Returns [time: number, update: () => void][]

    Array of tuples, [ timing of the event, a function that execute the event ]

createItemConstant

createItemCurve

createItemFromData

cueReset

  • cueReset(): void

deserialize

  • deserialize(data: SerializedChannel): void

duplicateItem

forceMoveItem

  • forceMoveItem(id: string, time: number): void

getItem

getItemByIndex

getNumItems

  • getNumItems(): number

getSpecificStatus

  • getSpecificStatus<T>(code: T): Status<T> | null

getValue

  • getValue(time: number): number
  • Return the value of specified time point.

    Parameters

    • time: number

      Time at the point you want to grab the value.

    Returns number

    Result value

getValueFromGUI

  • getValueFromGUI(time: number): number
  • If you want to grab a value from GUI for some reasons, use this. This supresses updating the preview value for curves.

    Parameters

    • time: number

      Time at the point you want to grab the value.

    Returns number

    Result value

isLastItem

  • isLastItem(id: string): boolean

markAsUsed

  • markAsUsed(): void

moveItem

  • moveItem(id: string, time: number): void

off

  • off<TType>(type: TType, listener: EventListener<ChannelWithGUIEvents[TType]>): void

on

removeItem

  • removeItem(id: string): void

repeatItem

reset

  • reset(): void

resizeItem

  • resizeItem(id: string, length: number, stretch?: undefined | false | true): void

resizeItemByLeft

  • resizeItemByLeft(id: string, length: number, stretch?: undefined | false | true): void
  • Resize an item by left side of the end. It's very GUI dev friendly method. yeah.

    Parameters

    • id: string

      Index of the item you want to resize

    • length: number

      Length

    • Optional stretch: undefined | false | true

      Wheter it should stretch the item or not

    Returns void

serialize

  • serialize(): SerializedChannel

subscribe

  • subscribe(listener: (event: ChannelUpdateEvent) => void): void
  • Add a new listener that receives a [[ChannelUpdateEvent]] when an update is happened.

    Parameters

    • listener: (event: ChannelUpdateEvent) => void

      A subscribing listener

        • (event: ChannelUpdateEvent): void
        • Parameters

          • event: ChannelUpdateEvent

          Returns void

    Returns void

tryGetItem

Generated using TypeDoc