Class Application<P, E>

Represents an x4 application, which is typically a single page app. You should inherit Application to define yours. Application derives from BaseComponent so you can use that to implement a global messaging system.

Example

```ts

// in yout main caode let app = new Application( );

app.events.close.on( ( ev ) => { ... do something });

// somewhere else in the source function xxx( ) { let app = Application.instance( ); app.events.close.emit( new Events.close() ); }

Type Parameters

Hierarchy

Constructors

Properties

#m_timers: Map<string, Function>
m_app_name: string
m_app_uid: string
m_app_version: string
m_local_storage: Settings
m_props: P
m_touch_count: number
m_touch_time: number
m_user_data: any
self: Application<ApplicationProps, ApplicationEventMap> = null

Accessors

Methods

  • emit an event you can stop propagation of event or prevent default

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • type: K
    • Optional event: E[K]

      event data

    Returns void

  • stop listening to an event

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • type: K
    • callback: ((ev: E[K]) => any)

      callback to remove (must be the same as in on )

        • (ev: E[K]): any
        • Parameters

          • ev: E[K]

          Returns any

    Returns void

  • listen for an event

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • type: K
    • callback: ((ev: E[K]) => any)

      callback to call

        • (ev: E[K]): any
        • Parameters

          • ev: E[K]

          Returns any

    Returns EventDisposer

  • handle an event one time

    Returns

    Promise if callback is null

    take care with that because if the event is never fired and you await it, the system may overflow

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • type: K
    • callback: ((ev: E[K]) => any)

      callback to call when event is signaled

        • (ev: E[K]): any
        • Parameters

          • ev: E[K]

          Returns any

    Returns void

  • signal en event signaled event are notification : no way to prevent default not stop propagation

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • type: K
    • event: E[K]

      event data

    • delay: number = -1

    Returns void

  • start a new timer

    Parameters

    • name: string

      timer name

    • timeout: number

      time out in ms

    • repeat: boolean = true

      if true this is an auto repeat timer

    • callback: TimerCallback = null

      if !null, the callback to call else a EvTimer is fired

    Returns void

Generated using TypeDoc