React SPA Framework - ViewCache - Methods

This section describes the methods used to manipulate the application's view cache.

clear()

Removes all the viewInfo objects from the cache.

getView(key)

Obtains a viewInfo object from the cache by the specified key.

Parameters:
key:

String

A key under which the requested viewInfo object is stored within the view cache.

Return Value:

Object

A requested viewInfo object.

hasView(key)

Checks whether or not a viewInfo object is contained in the view cache under the specified key.

Parameters:
key:

String

The key of the requested viewInfo object.

Return Value:

Boolean

true if the requested viewInfo object is found in the view cache.

off(eventName)

Detaches all event handlers from a single event.

Parameters:
eventName:

String

The event's name.

Return Value: ViewCache

The object for which this method is called.

See Also

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

Parameters:
eventName:

String

The event's name.

eventHandler:

Function

The event's handler.

Return Value: ViewCache

The object for which this method is called.

See Also

on(eventName, eventHandler)

Subscribes to an event.

Parameters:
eventName:

String

The event's name.

eventHandler:

Function

The event's handler.

Return Value: ViewCache

The object for which this method is called.

Use this method to subscribe to one of the events listed in the Events section.

See Also

on(events)

Subscribes to events.

Parameters:
events:

Object

Events with their handlers: { "eventName1": handler1, "eventName2": handler2, ...}

Return Value: ViewCache

The object for which this method is called.

Use this method to subscribe to several events with one method call. Available events are listed in the Events section.

See Also

removeView(key)

Removes a viewInfo object from the cache by the specified key.

Parameters:
key:

String

A key under which the viewInfo object to be removed is stored within the view cache.

Return Value:

Object

The viewInfo object that has been removed.

This method fires the viewRemoved event after the viewInfo object has been removed.

setView(key, viewInfo)

Adds the specified viewInfo object to the cache under the specified key.

Parameters:
key:

String

A key for the added viewInfo object.

viewInfo:

Object

An object whose fields define information on the cached view.