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: 18 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: 2024-10-16T11:53:41.796Z (2 months 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
```