Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jywarren/urlhash
A simple library for reading and writing parameters to the URL hash.
https://github.com/jywarren/urlhash
hash javascript url url-hash
Last synced: about 2 months ago
JSON representation
A simple library for reading and writing parameters to the URL hash.
- Host: GitHub
- URL: https://github.com/jywarren/urlhash
- Owner: jywarren
- License: mit
- Created: 2017-10-15T03:36:18.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-18T18:41:38.000Z (about 7 years ago)
- Last Synced: 2024-11-14T10:34:29.697Z (about 2 months ago)
- Topics: hash, javascript, url, url-hash
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# urlhash
A simple library for reading and writing parameters to the URL hash.## Installation
You can install with `npm install urlhash` and include with `var urlHash = require('urlhash')`.
For basic use in the browser, you can simply include `urlHash.js` and use `urlHash().getUrlHashParameter(param)` as below.
## Usage
`urlHash.getUrlHashParameter(param)`
returns the value of the named url hash parameter, so `bar` from `example.com#foo=bar`
`urlHash.getUrlHashParameters()`
returns all url hash parameters in an object, so `{foo: 'bar', bibim: 'bap'}` from `example.com#foo=bar&bibim=bap`
`urlHash.setUrlHashParameter(param, value)`
sets the value of the named url hash parameter, so `example.com#foo=bar` from `setUrlHashParameter('foo', 'bar')`
`urlHash.setUrlHashParameters(params)`
sets all url hash parameters in a passed object, so `example.com#foo=bar&bibim=bap` from `{foo: 'bar', bibim: 'bap'}`