Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DelayedCall

A DelayedCall allows you to execute a method after a certain time has passed. Since it implements the IAnimatable interface, it can be added to a juggler. In most cases, you do not have to use this class directly; the juggler class contains a method to delay calls directly.

DelayedCall dispatches an Event of type 'Event.REMOVE_FROM_JUGGLER' when it is finished, so that the juggler automatically removes it when its no longer needed.

@see Juggler

Hierarchy

Implements

Index

Constructors

constructor

  • new DelayedCall(callback: Function, delay: number, args?: Array<any>): DelayedCall

Properties

arguments

arguments: Array<any>

The arguments that the callback will be executed with. Beware: not a copy, but the actual object!

callback

callback: Function

The callback that will be executed when the time is up.

currentTime

currentTime: number

The time that has already passed (in seconds).

isComplete

isComplete: boolean

Indicates if enough time has passed, and the call has already been executed.

repeatCount

repeatCount: number

The number of times the call will be repeated. Set to '0' to repeat indefinitely. @default 1

totalTime

totalTime: number

The time for which calls will be delayed (in seconds).

Methods

addEventListener

  • addEventListener(type: string, listener: Function): void

advanceTime

  • advanceTime(time: number): void

complete

  • complete(): void
  • Advances the delayed call so that it is executed right away. If 'repeatCount' is anything else than '1', this method will complete only the current iteration.

    Returns void

dispatchEvent

  • dispatchEvent(event: Event): void
  • Dispatches an event to all objects that have registered listeners for its type. If an event with enabled 'bubble' property is dispatched to a display object, it will travel up along the line of parents, until it either hits the root object or someone stops its propagation manually.

    Parameters

    Returns void

dispatchEventWith

  • dispatchEventWith(type: string, bubbles?: boolean, data?: any): void

Protected get_arguments

  • get_arguments(): Array<any>

Protected get_callback

  • get_callback(): Function

Protected get_currentTime

  • get_currentTime(): number

Protected get_isComplete

  • get_isComplete(): boolean

Protected get_repeatCount

  • get_repeatCount(): number

Protected get_totalTime

  • get_totalTime(): number

hasEventListener

  • hasEventListener(type: string, listener?: any): boolean

removeEventListener

  • removeEventListener(type: string, listener: Function): void

removeEventListeners

  • removeEventListeners(type?: string): void

reset

  • reset(callback: Function, delay: number, args?: Array<any>): DelayedCall

Protected set_repeatCount

  • set_repeatCount(value: number): number

Generated using TypeDoc