Class Event

A simple publisher-subscriber implementation.

class

Event

constructor

Index

Constructor methods

Methods

Constructor methods

constructor(): Event

Returns

Event

Methods

public notify(args?: T in Slick.Event<T>, e?: EventData, scope?: any): any

Fires an event notifying all subscribers.

method

notify

note

slick.core.Event.notify shows this method as returning a value, type is unknown.

Parameters

  • args?: T in Slick.Event<T> optional

    Additional data object to be passed to all handlers.

  • e?: EventData optional
     Optional.
     An <code>EventData</code> object to be passed to all handlers.
     For DOM events, an existing W3C/jQuery event object can be passed in.
    
  • scope?: any optional
     Optional.
     The scope ("this") within which the handler will be executed.
     If not specified, the scope will be set to the <code>Event</code> instance.
    

Returns

any

Last run callback result.

public notify(args?: T in Slick.Event<T>, e?: DOMEvent, scope?: any): any

Parameters

  • args?: T in Slick.Event<T> optional
  • e?: DOMEvent optional
  • scope?: any optional

Returns

any

public subscribe(fn: (eventData: Slick.EventData, data: T) => any)

Adds an event handler to be called when the event is fired.

Event handler will receive two arguments - an EventData and the data object the event was fired with.

method

subscribe

Parameters

  • fn: (eventData: Slick.EventData, data: T) => any

    Event handler.

public unsubscribe(fn: (eventData: Slick.EventData, data: T) => any)

Removes an event handler added with subscribe(fn).

method

unsubscribe

Parameters

  • fn: (eventData: Slick.EventData, data: T) => any

    Event handler to be removed.