Interface IDurandalViewModelActiveItem

Index

Call signatures

Properties

Methods

Call signatures

(val?: any): any

knockout observable

Parameters

  • val?: any optional

Returns

any

Properties

public settings: IViewModelDefaults

A property which is the home to some basic settings and functions that control how all activators work. These are used to create the instance settings object for each activator. They can be overriden on a per-instance-basis by passing a settings object when creating an activator or by accessing the settings property of the activator. To change them for all activators, change them on the defaults property. The two most common customizations are presented below. See the source for additional information.

Methods

public activate(): JQueryPromise

Activates the activator...that is..it activates it's current item or initial value.

Returns

JQueryPromise

public activateItem(newItem: any, activationData?: any): JQueryPromise

Activates a specific item. Activation follows the lifecycle and thus only occurs if possible. activationData functions as stated above.

Parameters

  • newItem: any
  • activationData?: any optional

Returns

JQueryPromise

public canActivate(): JQueryPromise

Checks whether or not the activator itself can be activated...that is whether or not it's current item or initial value can be activated.

Returns

JQueryPromise

public canActivateItem(newItem: any, activationData?: any): JQueryPromise

Determines if a specific item can be activated. You can pass an arbitrary object to this function, which will be passed to the item's canActivate function , if present. This is useful if you are manually controlling activation and you want to provide some context for the operation.

Parameters

  • newItem: any
  • activationData?: any optional

Returns

JQueryPromise

public canDeactivate(): JQueryPromise

Checks whether or not the activator itself can be deactivated...that is whether or not it's current item can be deactivated.

Returns

JQueryPromise

public canDeactivateItem(item: any, close: any): JQueryPromise

Pass a specific item as well as an indication of whether it should be closed, and this function will tell you the answer.

Parameters

  • item: any
  • close: any

Returns

JQueryPromise

public deactivate(): JQueryDeferred

Deactivates the activator...interpreted as deactivating its current item.

Returns

JQueryDeferred

public deactivateItem(item: any, close: any): JQueryDeferred

Deactivates the specified item (optionally closing it). Deactivation follows the lifecycle and thus only works if the item can be deactivated.

Parameters

  • item: any
  • close: any

Returns

JQueryDeferred

public forItems(items: any): IDurandalViewModelActiveItem

Sets up a collection representing a pool of objects which the activator will activate. See below for details. Activators without an item boolean always close their values on deactivate. Activators with an items pool only deactivate, but do not close them.

Parameters

  • items: any

Returns

IDurandalViewModelActiveItem

public includeIn(includeIn: any): JQueryPromise

Adds canActivate, activate, canDeactivate and deactivate functions to the provided model which pass through to the corresponding functions on the activator.

Parameters

  • includeIn: any

Returns

JQueryPromise

public isActivating(val?: boolean): boolean

This observable is set internally by the activator during the activation process. It can be used to determine if an activation is currently happening.

Parameters

  • val?: boolean optional

Returns

boolean