Class History
This class represents an instance of the browser history utility.
Methods
private
void
_checkIframeLoaded
(
)
Periodically checks whether our internal IFrame is ready to be used
private
string
_getHash
(
)
Returns the portion of the hash after the '#' symbol.
Returns:
string
The hash portion of the document's location
private
void
_handleFQStateChange
(
fqstate
)
Sets the new currentState attribute of all modules depending on the new fully
qualified state. Also notifies the modules which current state has changed.
Parameters:
fqstate
<string >
fully qualified state
private
void
_initialize
(
)
Finish up the initialization of the browser utility library.
private
void
_storeStates
(
)
Stores the initial state and current state for all registered modules
in the (hidden) form field specified during initialization.
private
boolean
_updateIFrame
(
)
Update the IFrame with our new state.
Returns:
boolean
true if successful. false otherwise.
string
getBookmarkedState
(
moduleId
)
Returns the state of a module according to the URL fragment
identifier. This method is useful to initialize your modules
if your application was bookmarked from a particular state.
Parameters:
moduleId
<string >
Non-empty string representing your module.
Returns:
string
The bookmarked state of the specified module.
string
getCurrentState
(
moduleId
)
Returns the current state of the specified module.
Parameters:
moduleId
<string >
Non-empty string representing your module.
Returns:
string
The current state of the specified module.
string
getQueryStringParameter
(
paramName
,
queryString
)
Returns the value of the specified query string parameter.
This method is not used internally by the Browser History Manager.
However, it is provided here as a helper since many applications
using the Browser History Manager will want to read the value of
url parameters to initialize themselves.
Parameters:
paramName
<string >
Name of the parameter we want to look up.
queryString
<string >
Optional URL to look at. If not specified,
this method uses the URL in the address bar.
Returns:
string
The value of the specified parameter, or null.
void
initialize
(
stateField
,
historyIFrame
)
Initializes the Browser History Manager. Call this method
from a script block located right after the opening body tag.
Parameters:
stateField
<string|HTML Element >
used
to store application states. Must be in the static markup.
historyIFrame
<string|HTML Element >
IFrame used to store
the history (only required for IE6/7)
boolean
multiNavigate
(
states
)
Stores a new entry in the browser history by changing the state
of several registered modules in one atomic operation.
Parameters:
states
<object >
Associative array of module-state pairs to set simultaneously.
Returns:
boolean
Indicates whether the new state was successfully added to the history.
boolean
navigate
(
module
,
state
)
Stores a new entry in the browser history by changing the state of a registered module.
Parameters:
module
<string >
Non-empty string representing your module.
state
<string >
String representing the new state of the specified module.
Returns:
boolean
Indicates whether the new state was successfully added to the history.
History.Module
register
(
moduleId
,
initialState
)
Registers a new module.
Parameters:
moduleId
<string >
Non-empty string uniquely identifying the
module you wish to register.
initialState
<string >
The initial state of the specified
module corresponding to its earliest history entry.
Returns:
History.Module
The newly registered module
Events
history:globalStateChange
(
)
Fires when the global state of the page has changed (that is,
when the state of at least one browser history module has changed)
history:moduleStateChange
(
)
Fires when the state of a history module object has changed
history:ready
(
)
Fires when the browser history utility is ready