Interface Component

Hierarchy

Index

Properties

Methods

Properties

public $node: JQuery

public node: Element

Methods

public after(method: string, fn: Function)

Run the customFunc function after the existingFunc function.

Parameters

  • method: string
  • fn: Function

public around(method: string, fn: Function)

Run the existingFunc function in the middle of the customFunc function. It's similar to underscore's _wrap function).

Parameters

  • method: string
  • fn: Function

public attributes(obj: Object)

Most Components and Mixins need to define attributes. In Flight, default values are assigned by passing an object to the attributes function.

NOTE: this.attributes replaces the now deprecated this.defaultAttrs. However, for backwards compatibility, if you are using this.defaultAttrs then all the old attribute behavior remains in place.

Parameters

  • obj: Object

public attributes(obj: Object)

Most Components and Mixins need to define attributes. In Flight, default values are assigned by passing an object to the attributes function.

NOTE: this.attributes replaces the now deprecated this.defaultAttrs. However, for backwards compatibility, if you are using this.defaultAttrs then all the old attribute behavior remains in place.

Parameters

  • obj: Object

public before(method: string, fn: Function)

Run the customFunc function before the existingFunc function.

Parameters

  • method: string
  • fn: Function

public defaultAttrs(obj: Object)

Most Components and Mixins need to define attributes. In Flight, default values are assigned by passing an object to the defaultAttrs function.

NOTE: this.attributes replaces the now deprecated this.defaultAttrs. However, for backwards compatibility, if you are using this.defaultAttrs then all the old attribute behavior remains in place.

Parameters

  • obj: Object

public defaultAttrs(obj: Object)

Most Components and Mixins need to define attributes. In Flight, default values are assigned by passing an object to the defaultAttrs function.

NOTE: this.attributes replaces the now deprecated this.defaultAttrs. However, for backwards compatibility, if you are using this.defaultAttrs then all the old attribute behavior remains in place.

Parameters

  • obj: Object

public initialize(node: any, options: Object)

This method is attached to the prototype of every Component; it accepts the component's node and an options object as arguments. The core implementation, which is called every time an instance is created, will assign the node to the instance and override the default attrs with the options object.

Components and Mixins will typically augment the core implementation by supplying a function as an argument to the after method (see the advice API for more information). This is a good place to set up event listeners that bind to callbacks.

Parameters

  • node: any
  • options: Object

public initialize(node: any, options: Object)

This method is attached to the prototype of every Component; it accepts the component's node and an options object as arguments. The core implementation, which is called every time an instance is created, will assign the node to the instance and override the default attrs with the options object.

Components and Mixins will typically augment the core implementation by supplying a function as an argument to the after method (see the advice API for more information). This is a good place to set up event listeners that bind to callbacks.

Parameters

  • node: any
  • options: Object

public off(eventType: string, handler?: Function)

If we no longer want a component instance to listen to an event we can use the off method to unsubscribe.

Parameters

  • eventType: string

    The event type being listened to.

  • handler?: Function optional

    Optional. The function (callback) to detach from the component instance. Defaults to the detaching all callbacks for the event.

public off(selector: string, eventType: string, handler?: Function)

Parameters

  • selector: string
  • eventType: string
  • handler?: Function optional

public off(selector: Document, eventType: string, handler?: Function)

Parameters

  • selector: Document
  • eventType: string
  • handler?: Function optional

public off(selector: Element, eventType: string, handler?: Function)

Parameters

  • selector: Element
  • eventType: string
  • handler?: Function optional

public off(selector: Array<Element>, eventType: string, handler?: Function)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler?: Function optional

public off(selector: string, eventType: Object, handler?: Function)

Parameters

  • selector: string
  • eventType: Object
  • handler?: Function optional

public off(selector: Document, eventType: Object, handler?: Function)

Parameters

  • selector: Document
  • eventType: Object
  • handler?: Function optional

public off(selector: Element, eventType: Object, handler?: Function)

Parameters

  • selector: Element
  • eventType: Object
  • handler?: Function optional

public off(selector: Array<Element>, eventType: Object, handler?: Function)

Parameters

  • selector: Array<Element>
  • eventType: Object
  • handler?: Function optional

public off(selector: string, eventType: string, handler?: Object)

Parameters

  • selector: string
  • eventType: string
  • handler?: Object optional

public off(selector: Document, eventType: string, handler?: Object)

Parameters

  • selector: Document
  • eventType: string
  • handler?: Object optional

public off(selector: Element, eventType: string, handler?: Object)

Parameters

  • selector: Element
  • eventType: string
  • handler?: Object optional

public off(selector: Array<Element>, eventType: string, handler?: Object)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler?: Object optional

public off(selector: string, eventType: Object, handler?: Object)

Parameters

  • selector: string
  • eventType: Object
  • handler?: Object optional

public off(selector: Document, eventType: Object, handler?: Object)

Parameters

  • selector: Document
  • eventType: Object
  • handler?: Object optional

public off(selector: Element, eventType: Object, handler?: Object)

Parameters

  • selector: Element
  • eventType: Object
  • handler?: Object optional

public off(selector: Array<Element>, eventType: Object, handler?: Object)

Parameters

  • selector: Array<Element>
  • eventType: Object
  • handler?: Object optional

public off(eventType: string, handler?: Function)

If we no longer want a component instance to listen to an event we can use the off method to unsubscribe.

Parameters

  • eventType: string

    The event type being listened to.

  • handler?: Function optional

    Optional. The function (callback) to detach from the component instance. Defaults to the detaching all callbacks for the event.

public off(selector: string, eventType: string, handler?: Function)

Parameters

  • selector: string
  • eventType: string
  • handler?: Function optional

public off(selector: Document, eventType: string, handler?: Function)

Parameters

  • selector: Document
  • eventType: string
  • handler?: Function optional

public off(selector: Element, eventType: string, handler?: Function)

Parameters

  • selector: Element
  • eventType: string
  • handler?: Function optional

public off(selector: Array<Element>, eventType: string, handler?: Function)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler?: Function optional

public off(selector: string, eventType: Object, handler?: Function)

Parameters

  • selector: string
  • eventType: Object
  • handler?: Function optional

public off(selector: Document, eventType: Object, handler?: Function)

Parameters

  • selector: Document
  • eventType: Object
  • handler?: Function optional

public off(selector: Element, eventType: Object, handler?: Function)

Parameters

  • selector: Element
  • eventType: Object
  • handler?: Function optional

public off(selector: Array<Element>, eventType: Object, handler?: Function)

Parameters

  • selector: Array<Element>
  • eventType: Object
  • handler?: Function optional

public off(selector: string, eventType: string, handler?: Object)

Parameters

  • selector: string
  • eventType: string
  • handler?: Object optional

public off(selector: Document, eventType: string, handler?: Object)

Parameters

  • selector: Document
  • eventType: string
  • handler?: Object optional

public off(selector: Element, eventType: string, handler?: Object)

Parameters

  • selector: Element
  • eventType: string
  • handler?: Object optional

public off(selector: Array<Element>, eventType: string, handler?: Object)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler?: Object optional

public off(selector: string, eventType: Object, handler?: Object)

Parameters

  • selector: string
  • eventType: Object
  • handler?: Object optional

public off(selector: Document, eventType: Object, handler?: Object)

Parameters

  • selector: Document
  • eventType: Object
  • handler?: Object optional

public off(selector: Element, eventType: Object, handler?: Object)

Parameters

  • selector: Element
  • eventType: Object
  • handler?: Object optional

public off(selector: Array<Element>, eventType: Object, handler?: Object)

Parameters

  • selector: Array<Element>
  • eventType: Object
  • handler?: Object optional

public on(eventType: string, handler: Function)

This allows a component instance to listen to an event and register a callback to be invoked. Flight will automatically bind the context (this) of the callback to the component instance.

Parameters

  • eventType: string

    The event type to listen for.

  • handler: Function

    Either a function (callback) to be invoked, or a map of targets and callbacks.

public on(eventType: string, handler: Object)

Parameters

  • eventType: string
  • handler: Object

public on(selector: string, eventType: string, handler: Function)

Parameters

  • selector: string
  • eventType: string
  • handler: Function

public on(selector: Document, eventType: string, handler: Function)

Parameters

  • selector: Document
  • eventType: string
  • handler: Function

public on(selector: Element, eventType: string, handler: Function)

Parameters

  • selector: Element
  • eventType: string
  • handler: Function

public on(selector: Array<Element>, eventType: string, handler: Function)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler: Function

public on(selector: string, eventType: string, handler: Object)

Parameters

  • selector: string
  • eventType: string
  • handler: Object

public on(selector: Document, eventType: string, handler: Object)

Parameters

  • selector: Document
  • eventType: string
  • handler: Object

public on(selector: Element, eventType: string, handler: Object)

Parameters

  • selector: Element
  • eventType: string
  • handler: Object

public on(selector: Array<Element>, eventType: string, handler: Object)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler: Object

public on(eventType: string, handler: Function)

This allows a component instance to listen to an event and register a callback to be invoked. Flight will automatically bind the context (this) of the callback to the component instance.

Parameters

  • eventType: string

    The event type to listen for.

  • handler: Function

    Either a function (callback) to be invoked, or a map of targets and callbacks.

public on(eventType: string, handler: Object)

Parameters

  • eventType: string
  • handler: Object

public on(selector: string, eventType: string, handler: Function)

Parameters

  • selector: string
  • eventType: string
  • handler: Function

public on(selector: Document, eventType: string, handler: Function)

Parameters

  • selector: Document
  • eventType: string
  • handler: Function

public on(selector: Element, eventType: string, handler: Function)

Parameters

  • selector: Element
  • eventType: string
  • handler: Function

public on(selector: Array<Element>, eventType: string, handler: Function)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler: Function

public on(selector: string, eventType: string, handler: Object)

Parameters

  • selector: string
  • eventType: string
  • handler: Object

public on(selector: Document, eventType: string, handler: Object)

Parameters

  • selector: Document
  • eventType: string
  • handler: Object

public on(selector: Element, eventType: string, handler: Object)

Parameters

  • selector: Element
  • eventType: string
  • handler: Object

public on(selector: Array<Element>, eventType: string, handler: Object)

Parameters

  • selector: Array<Element>
  • eventType: string
  • handler: Object

public select(attr: string): JQuery

The select method takes an attr key as its argument. The value of the attr must be a CSS Selector. The method will return all matching elements within the component's node.

This is a handy alternative to jQuery's this.$node.find() and prevents accidental access to elements outside of the component's node.

Parameters

  • attr: string

Returns

JQuery

public select(attr: string): JQuery

The select method takes an attr key as its argument. The value of the attr must be a CSS Selector. The method will return all matching elements within the component's node.

This is a handy alternative to jQuery's this.$node.find() and prevents accidental access to elements outside of the component's node.

Parameters

  • attr: string

Returns

JQuery

public teardown()

Remove a component instance and its event bindings.

It's a good idea to teardown components after each unit test - and teardown is also good for unbinding event listeners when, for example, the user navigates away from a page.

public teardown()

Remove a component instance and its event bindings.

It's a good idea to teardown components after each unit test - and teardown is also good for unbinding event listeners when, for example, the user navigates away from a page.

public trigger(eventType: string)

Trigger an event.

Parameters

  • eventType: string

    String. The event type to be triggered.

    You can also specify a default function that will be called by the component, providing that nothing in the event's bubble chain invokes preventDefault. Default functions in custom events are analagous to the default actions of native events.

    To define a default function, make the eventType argument an object that specifies the event's type and a defaultBehavior property. A common use case is defining default behavior for keyboard events.

public trigger(selector: string, eventType: string, eventPayload?: Object)

Parameters

  • selector: string
  • eventType: string
  • eventPayload?: Object optional

public trigger(selector: Document, eventType: string, eventPayload?: Object)

Parameters

  • selector: Document
  • eventType: string
  • eventPayload?: Object optional

public trigger(selector: Element, eventType: string, eventPayload?: Object)

Parameters

  • selector: Element
  • eventType: string
  • eventPayload?: Object optional

public trigger(selector: Array<Element>, eventType: string, eventPayload?: Object)

Parameters

  • selector: Array<Element>
  • eventType: string
  • eventPayload?: Object optional

public trigger(eventType: Object)

Parameters

  • eventType: Object

public trigger(selector: string, eventType: Object, eventPayload?: Object)

Parameters

  • selector: string
  • eventType: Object
  • eventPayload?: Object optional

public trigger(selector: Document, eventType: Object, eventPayload?: Object)

Parameters

  • selector: Document
  • eventType: Object
  • eventPayload?: Object optional

public trigger(selector: Element, eventType: Object, eventPayload?: Object)

Parameters

  • selector: Element
  • eventType: Object
  • eventPayload?: Object optional

public trigger(selector: Array<Element>, eventType: Object, eventPayload?: Object)

Parameters

  • selector: Array<Element>
  • eventType: Object
  • eventPayload?: Object optional

public trigger(eventType: string)

Trigger an event.

Parameters

  • eventType: string

    String. The event type to be triggered.

    You can also specify a default function that will be called by the component, providing that nothing in the event's bubble chain invokes preventDefault. Default functions in custom events are analagous to the default actions of native events.

    To define a default function, make the eventType argument an object that specifies the event's type and a defaultBehavior property. A common use case is defining default behavior for keyboard events.

public trigger(selector: string, eventType: string, eventPayload?: Object)

Parameters

  • selector: string
  • eventType: string
  • eventPayload?: Object optional

public trigger(selector: Document, eventType: string, eventPayload?: Object)

Parameters

  • selector: Document
  • eventType: string
  • eventPayload?: Object optional

public trigger(selector: Element, eventType: string, eventPayload?: Object)

Parameters

  • selector: Element
  • eventType: string
  • eventPayload?: Object optional

public trigger(selector: Array<Element>, eventType: string, eventPayload?: Object)

Parameters

  • selector: Array<Element>
  • eventType: string
  • eventPayload?: Object optional

public trigger(eventType: Object)

Parameters

  • eventType: Object

public trigger(selector: string, eventType: Object, eventPayload?: Object)

Parameters

  • selector: string
  • eventType: Object
  • eventPayload?: Object optional

public trigger(selector: Document, eventType: Object, eventPayload?: Object)

Parameters

  • selector: Document
  • eventType: Object
  • eventPayload?: Object optional

public trigger(selector: Element, eventType: Object, eventPayload?: Object)

Parameters

  • selector: Element
  • eventType: Object
  • eventPayload?: Object optional

public trigger(selector: Array<Element>, eventType: Object, eventPayload?: Object)

Parameters

  • selector: Array<Element>
  • eventType: Object
  • eventPayload?: Object optional