Class Router

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(options?: RouterOptions): Router

Parameters

Returns

Router

Properties

public app: App

public namespace: string

public triggers: StringMap

Methods

public bind(eventName: string, callback: Function, context?: any): any

Parameters

  • eventName: string
  • callback: Function
  • context?: any optional

Returns

any

public cause(appEvent: string, args?: Array<any>): any

Parameters

  • appEvent: string
  • args?: Array<any> optional

Returns

any

public getRoute(appEvent: string, args?: Array<any>): string

Parameters

  • appEvent: string
  • args?: Array<any> optional

Returns

string

public initialize(options?: RouterOptions)

Parameters

public isCaused(appEvent: string, args?: Array<any>): boolean

Parameters

  • appEvent: string
  • args?: Array<any> optional

Returns

boolean

public listenTo(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public listenToOnce(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public navigate(fragment: string, options?: NavigateOptions): Router

Parameters

Returns

Router

public navigate(fragment: string, trigger?: boolean): Router

Parameters

  • fragment: string
  • trigger?: boolean optional

Returns

Router

public off(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any

public on(eventName: string, callback?: Function, context?: any): any

Parameters

  • eventName: string
  • callback?: Function optional
  • context?: any optional

Returns

any

public once(events: string, callback: Function, context?: any): any

Parameters

  • events: string
  • callback: Function
  • context?: any optional

Returns

any

public reload(url: string): any

Parameters

  • url: string

Returns

any

public route(route: string, name: string, callback?: Function): Router

Parameters

  • route: string
  • name: string
  • callback?: Function optional

Returns

Router

public routes(): any

Routes hash or a method returning the routes hash that maps URLs with parameters to methods on your Router. For assigning routes as object hash, do it like this: this.routes = { "route": callback, ... }; That works only if you set it in the constructor or the initialize method.

Returns

any

public stopListening(object?: any, events?: string, callback?: Function): any

Parameters

  • object?: any optional
  • events?: string optional
  • callback?: Function optional

Returns

any

public trigger(eventName: string, args?: Array<any>): any

Parameters

  • eventName: string
  • args?: Array<any> optional

Returns

any

public unbind(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any