Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moinism/hashuery
A JavaScript library to parse query in URL's Hash.
https://github.com/moinism/hashuery
Last synced: 24 days ago
JSON representation
A JavaScript library to parse query in URL's Hash.
- Host: GitHub
- URL: https://github.com/moinism/hashuery
- Owner: moinism
- Created: 2014-09-30T15:14:59.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-09-30T18:51:51.000Z (about 10 years ago)
- Last Synced: 2023-03-27T22:36:49.109Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hashuery
A JavaScript library to parse query in URL's Hash.
Example:
-------When URL looks like:
```
http://example.com/#this=hash&data=anything
```Would be returned as a JavaScript object:
```javascript
{
"this": "hash",
"data": "anything"
}
```Usage
-----Initialize:
```javascript
var hash = new hashuery();
```Getting the current value:
```javascript
var current = hash.get();
```Setting a new value:
```javascript
hash.set({
"foo": "bar"
});
```Append data instaed of setting:
```javascript
hash.append({
"baz": "bar"
});
```Clear URL
```javascript
hash.clear();
```Events:
------It has two events:
```javascript
.onChange(function(newHash){}) // pass the function to be called when hash changes
```
and
```javascript
.onClear(function(){}) // pass the function to be called when hash is cleared
```