hashquery
v1.0.0
Published
query string like key value management for window hash
Downloads
137
Readme
hashquery
A 1kb library to manage window.location.hash as key=value like query string
usage
http//foo.com
hashquery.set('hello', 'world');
http//foo.com#hello=world
hashquery.set('foo', 'bar');
http//foo.com#hello=world&foo=bar
var x = hashquery.get('hello'); // x = 'world'
hashquery.del('hello');
http//foo.com#foo=bar
hashquery.del('foo');
http//foo.com
install
npm install hashquery
usage
it can be included globally:
<script type="text/javascript" src="node_modules/hashquery/hashquery.iife.js"></script>
<script type="text/javascript">
hashquery.set('hello', 'world');
hashquery.set('foo', 'bar');
var x = hashquery.get('hello'); // x = 'world'
</script>
it can also be used with import:
import * as hashquery from 'hashquery';
hashquery.set('hello', 'world');
hashquery.set('foo', 'bar');
var x = hashquery.get('hello'); // x = 'world'
see index.html for its usage
license
MIT