https://github.com/viivue/easy-hash
https://github.com/viivue/easy-hash
easy-collection
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/viivue/easy-hash
- Owner: viivue
- License: mit
- Created: 2023-08-14T11:19:28.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-25T04:40:45.000Z (over 1 year ago)
- Last Synced: 2023-12-26T05:30:41.949Z (over 1 year ago)
- Topics: easy-collection
- Language: JavaScript
- Homepage: https://viivue.github.io/easy-hash/
- Size: 68.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Easy Hash
[](https://github.com/viivue/easy-hash/releases/latest)
[](https://app.netlify.com/sites/easy-hash/deploys)> Demo: https://easy-hash.netlify.app
## Getting started
### CDN
```html
```
## Initialize
We can use this library promptly after import it into your project
## Methods
| Usage | Description |
|------------------------------------|--------------------------------------------------------------------------------------------------------|
| `EasyHash.add(hash)` | Add new hash to the URL and replace the current one if any (containing "#" or not are both acceptable) |
| `EasyHash.remove()` | Remove current hash value |
| `EasyHash.getHash()` | Get current hash |
| `EasyHash.on(eventName, callback)` | Assign events |## Events
| Name | Description |
|------------|---------------------|
| `"change"` | After value changed |```js
EasyHash.on('change', () => {
// do something
})
// the same as window.addEventListener('hashchange',()=>{})
```## Deployment
```shell
# Run dev server
npm run dev# Build dev site
npm run build# Generate production files
npm run prod
```## License
[MIT License](https://github.com/viivue/easy-hash/blob/main/LICENSE)
Copyright (c) 2023 ViiVue