Class Router

Hierarchy

Index

Constructor methods

Methods

Constructor methods

constructor(options?: RouterOptions): Router

Parameters

Returns

Router

Methods

private _bindRoutes()

private _extractParameters(route: RegExp, fragment: string): Array<string>

Parameters

  • route: RegExp
  • fragment: string

Returns

Array<string>

private _routeToRegExp(route: string): RegExp

Parameters

  • route: string

Returns

RegExp

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

Parameters

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

Returns

any

private static extend(properties: any, classProperties?: any): any

Do not use, prefer TypeScript's extend functionality.

Parameters

  • properties: any
  • classProperties?: any optional

Returns

any

public initialize(options?: RouterOptions)

Parameters

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 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