conglomerate-history
v2.0.3
Published
cross-browser history management
Downloads
4
Readme
conglomerate-history
cross-browser history management
Documentation
History
Extends EventEmitter
Handles cross-browser history management, based on either pushState and real URLs, or onhashchange and URL fragments. If the browser supports neither.
_updateHash
Update the hash location, either replacing the current entry, or adding a new one to the browser history.
Parameters
checkUrl
Checks the current URL to see if it has changed, and if it has,
calls loadUrl
, normalizing across the hidden iframe.
Parameters
event
object
decodeFragment
Unicode characters in location.pathname
are percent encoded so they're
decoded for comparison. %25
should not be decoded since it may be part
of an encoded parameter.
Parameters
fragment
string
Returns string decoded fragment
getFragment
Get the cross-browser normalized URL fragment from the path or hash.
Parameters
fragment
boolean
Returns string normalized url fragment
getHash
Gets the true hash value. Cannot use location.hash dir in Firefox where location.hash will always be decoded.
Parameters
window
object the global window or History instance
Returns string
getPath
Get the pathname and search params, without the root.
Returns string pathname and search params
getSearch
In IE6, the hash fragment and search params are incorrect if the
fragment contains ?
.
Returns string
loadUrl
Attempt to load the current URL fragment. If a route succeeds with a match, fires 'change' event.
Parameters
fragment
string
matchRoot
Does the pathname match the root?
Returns boolean
navigate
Save a fragment into the hash history, or replace the URL state if the 'replace' option is passed. You are responsible for properly URL-encoding the fragment in advance.
The options object can contain trigger: true
if you wish to have the
route callback be fired (not usually desirable), or replace: true
, if
you wish to modify the current URL without adding an entry to the history.
Parameters
start
Start the hash change handling, returning true
if the current URL
matches an existing route, and false
otherwise.
Parameters
options
object
stop
Disable Backbone.history, perhaps temporarily. Not useful in a real app, but possibly useful for unit testing Routers.
License
conglomerate-history is released under the terms of the BSD-3-Clause license.
This software includes or is derivative of works distributed under the licenses listed below. Please refer to the specific files and/or packages for more detailed information about the authors, copyright notices, and licenses.
- Backbone is released under the terms of the MIT license.
Thanks
Thanks to Jeremy Ashkenas and the rest of the Backbone.js authors.