Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jfromaniello/hashi
an AMD polyfill for hashchange
https://github.com/jfromaniello/hashi
Last synced: 26 days ago
JSON representation
an AMD polyfill for hashchange
- Host: GitHub
- URL: https://github.com/jfromaniello/hashi
- Owner: jfromaniello
- Created: 2012-09-06T21:04:20.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-09-08T21:04:07.000Z (about 12 years ago)
- Last Synced: 2024-04-14T14:31:01.501Z (7 months ago)
- Language: JavaScript
- Size: 160 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Hashi is an small polyfill for the [hashchange event](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange).
It also works as an [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) module and can be installed from [jam](http://jamjs.org).# API
Add hashi.js or hashi.min.js to your html page. Then you can use as follows:
```javascript
function shout(){
alert("hash changed!");
}
hashi.addListener(shout);
```### Remove listener
```javascript
hashi.removeListener(shout);
```### Remove all listeners
```javascript
hashi.removeAllListeners();
```### AMD support
```javascript
require(["hashi"], function(hashi){
hashi.addListener(function(e){
alert("changed from " + e.oldURL + " to " + e.newURL);
})
});
```# Install with JAM
```
jam install hashi
```# License
MIT - José F. Romaniello 2012.