Class sap.ui.core.routing.HashChangerModule: sap/ui/core/routing/HashChanger
Class for manipulating and receiving changes of the browserhash with the hasher framework. Fires a "hashChanged" event if the browser hash changes.
Constructor Summary
Event Summary
hashReplaced(oEvent)The 'hashReplaced' event is fired when sap.ui.core.routing.HashChanger#replaceHash is called
Method Summary
sap.ui.core.routing.HashChanger.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.core.routing.HashChanger with name
sClassName
and enriches it with the information contained in oClassInfo
.sap.ui.core.routing.HashChanger.getMetadata()Returns a metadata object for class sap.ui.core.routing.HashChanger.
sap.ui.core.routing.HashChanger.replaceHashChanger(oHashChanger)Sets the hashChanger to a new instance, destroys the old one and copies all its event listeners to the new one
fireHashChanged(newHash, oldHash)Fires the hashchanged event, may be extended to modify the hash before fireing the event
Methods borrowed from class sap.ui.base.EventProvider
Methods borrowed from class sap.ui.base.Object
Event Detail
hashChanged(oEvent)
The 'hashChanged' event is fired when the URL hash is changed
Parameters:
{sap.ui.base.Event} | oEvent | |
{sap.ui.base.EventProvider} | oEvent.getSource | |
{object} | oEvent.getParameters | |
{string} | oEvent.getParameters.oldHash | The URL hash before it's changed |
{object} | oEvent.getParameters.newHash | The new URL hash |
hashReplaced(oEvent)
The 'hashReplaced' event is fired when sap.ui.core.routing.HashChanger#replaceHash is called
Parameters:
{sap.ui.base.Event} | oEvent | |
{sap.ui.base.EventProvider} | oEvent.getSource | |
{object} | oEvent.getParameters | |
{string} | oEvent.getParameters.sHash | The URL hash |
hashSet(oEvent)
The 'hashSet' event is fired when sap.ui.core.routing.HashChanger#setHash is called
Parameters:
{sap.ui.base.Event} | oEvent | |
{sap.ui.base.EventProvider} | oEvent.getSource | |
{object} | oEvent.getParameters | |
{string} | oEvent.getParameters.sHash | The URL hash |
Method Detail
sap.ui.core.routing.HashChanger.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.ui.core.routing.HashChanger with name
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.base.EventProvider.extend.
Parameters:
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
Returns:
{function} | Created class / constructor function |
sap.ui.core.routing.HashChanger.getInstance()
Gets a global singleton of the HashChanger. The singleton will get created when this function is invoked for the first time.
sap.ui.core.routing.HashChanger.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.core.routing.HashChanger.
Returns:
{sap.ui.base.Metadata} | Metadata object describing this class |
sap.ui.core.routing.HashChanger.replaceHashChanger(oHashChanger)
Sets the hashChanger to a new instance, destroys the old one and copies all its event listeners to the new one
Parameters:
{sap.ui.core.routing.HashChanger} | oHashChanger | the new instance for the global singleton |
fireHashChanged(newHash, oldHash)
Fires the hashchanged event, may be extended to modify the hash before fireing the event
Parameters:
{string} | newHash | the new hash of the browser |
{string} | oldHash | the previous hash |
init()
Will start listening to hashChanges with the parseHash function. This will also fire a hashchanged event with the initial hash.