class sap.ui.core.routing.HashChanger

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/core/routing/HashChanger
Application Component: CA-UI5-COR

Class for manipulating and receiving changes of the browser hash with the hasher framework.

Fires a hashChanged event if the browser hash changes.


Constructor

new sap.ui.core.routing.HashChanger()

Events Overview

Event Description
hashSet

The 'hashSet' event is fired when sap.ui.core.routing.HashChangerBase#setHash is called

hashSet

The 'hashSet' event is fired when sap.ui.core.routing.HashChangerBase#setHash is called

Param Type Description
oEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object
hash string

The relevant hash segment


Methods Overview

Method Description
destroy

Cleans the event registration

References:

  • sap.ui.base.Object.prototype.destroy

sap.ui.core.routing.HashChanger.extend

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.core.routing.HashChangerBase.extend.

fireHashChanged

Fires the hashchanged event, may be extended to modify the hash before fireing the event

getHash

Gets the current hash

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

Returns a metadata object for class sap.ui.core.routing.HashChanger.

getRelevantEventsInfo

Defines the events and its parameters which should be used for tracking the hash changes

init

Will start listening to hashChanges with the parseHash function. This will also fire a hashchanged event with the initial hash.

replaceHash

Replaces the hash with a certain value. When using the replace function, no browser history entry is written. If you want to have an entry in the browser history, please use the #setHash function.

sap.ui.core.routing.HashChanger.replaceHashChanger

Sets the hashChanger to a new instance, destroys the old one and copies all its event listeners to the new one

setHash

Sets the hash to a certain value. When using this function, a browser history entry is written. If you do not want to have an entry in the browser history, please use the #replaceHash function.

destroy

Cleans the event registration

References:

sap.ui.core.routing.HashChanger.extend

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.core.routing.HashChangerBase.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

fireHashChanged

Fires the hashchanged event, may be extended to modify the hash before fireing the event

Param Type DefaultValue Description
sNewHash string

the new hash of the browser

sOldHash string

the previous hash

getHash

Gets the current hash

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

Returns a metadata object for class sap.ui.core.routing.HashChanger.

getRelevantEventsInfo

Defines the events and its parameters which should be used for tracking the hash changes

init

Will start listening to hashChanges with the parseHash function. This will also fire a hashchanged event with the initial hash.

replaceHash

Replaces the hash with a certain value. When using the replace function, no browser history entry is written. If you want to have an entry in the browser history, please use the #setHash function.

Param Type DefaultValue Description
sHash string

New hash

sap.ui.core.routing.HashChanger.replaceHashChanger

Sets the hashChanger to a new instance, destroys the old one and copies all its event listeners to the new one

Param Type DefaultValue Description
oHashChanger sap.ui.core.routing.HashChanger

the new instance for the global singleton

setHash

Sets the hash to a certain value. When using this function, a browser history entry is written. If you do not want to have an entry in the browser history, please use the #replaceHash function.

Param Type DefaultValue Description
sHash string

New hash