new HistoryManager(options, data)
HistoryManager class for Spark Framework to handle hashbang or push state
navigations. This class uses classic hashbang routes but if you want to
use HTML5 History API you can also use it. Pass useHtml5History
option as
true. Make sure your browser supports HTML5 History API. HistoryManager can
be used as standalone but it's more powerful with Router. You should listen
Navigated
event to use HistoryManager when you use it standalone.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
options |
Object |
<optional> |
Class options. |
data |
* |
<optional> |
Class data |
- Source:
Extends
Classes
Methods
-
destroy()
-
Destroys the HistoryManager and goog.history instance.
- Source:
-
emit(eventName, data)
-
Dispatches an event and calls all listeners listening for events of this event. See also goog.events.Listenable.prototype.dispatchEvent
Parameters:
Name Type Argument Description eventName
string Name of the event.
data
* <optional>
Data which will passed to listeners
- Inherited From:
- Source:
-
freeze()
-
Freezes object to prevent adding new properties, updating or deleting existing properties.
- Inherited From:
- Source:
-
getData() → {*}
-
Returns class data.
- Inherited From:
- Source:
Returns:
Class data.
- Type
- *
-
<private> getHistoryInput_()
-
Returns a input element to give goog's History class. This prevents Firefox to reload the page. Also Firefox was throwing a security error on localhost when HistoryManager constructed. So this trick will also fix that issue too.
- Source:
-
getOption() → {*}
-
Returns value of a key in options object.
- Inherited From:
- Source:
Returns:
Value of key or null.
- Type
- *
-
getOptions() → {Object}
-
Returns all options object.
- Inherited From:
- Source:
Returns:
Options object.
- Type
- Object
-
getUid() → {string}
-
Return unique id.
- Inherited From:
- Source:
Returns:
Unique id of this component.
- Type
- string
-
isDestroyed() → {boolean}
-
Returns the object's destroy state.
- Inherited From:
- Source:
Returns:
Whether the object is destroyed or not.
- Type
- boolean
-
off(eventName, callback) → {boolean}
-
Removes an event listener which was added with @on or @once. See also goog.events.Listenable.prototype.unlisten
Parameters:
Name Type Description eventName
string Name of the event.
callback
function Callback function for the event.
- Inherited From:
- Source:
Returns:
Whether any listener was removed.
- Type
- boolean
-
on(eventName, callback) → {goog.events.ListenableKey|number}
-
Adds an event listener. See also goog.events.Listenable::listen
Parameters:
Name Type Description eventName
string Name of the event.
callback
function Callback function for the event.
- Inherited From:
- Source:
Returns:
Unique key for the listener.
- Type
- goog.events.ListenableKey | number
-
once(eventName, callback) → {goog.events.ListenableKey|number}
-
Adds an event listener that is removed automatically after the listener fired once. See also goog.events.Listenable.prototype.listenOnce
Parameters:
Name Type Description eventName
string Name of the event.
callback
function Callback function for the event.
- Inherited From:
- Source:
Returns:
Unique key for the listener.
- Type
- goog.events.ListenableKey | number
-
setData(data)
-
Sets data of this class.
Parameters:
Name Type Description data
* Data passed to class.
- Inherited From:
- Source:
-
setOptions(options)
-
Sets options object of this class.
Parameters:
Name Type Description options
Object Options object.
- Inherited From:
- Source:
-
setToken(token)
-
Set token method to update history token and change the page url.
Parameters:
Name Type Description token
string Token to change page url.
- Source:
-
<private> setUid_()
-
Sets uid.
- Inherited From:
- Source: