Skip to content

A 1kb javascript library to manage window.location.hash as key=value like query string

License

Notifications You must be signed in to change notification settings

ddaghan/hashquery

Repository files navigation

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

About

A 1kb javascript library to manage window.location.hash as key=value like query string

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published