j-HashChange
The component captures all changes for #hashtag in the URL address. When change, it emits event hash. The component reacts to the real changes.
- singleton
Configuration:
delay {Number}a delay for emittinghashevent (default:0)- NEW:
middleware {String}a middleware (separated by the comma) for initial emit of thehashevent
How to capture hash change?
// Global:
ON('hash', function(hash) {
// @hash {String} - it can be "empty"
});
// Or in the Plugin declaration:
exports.on('hash', function(hash) {
});Use it with <ui-component name="hashchange">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.
<ui-component name="hashchange"></ui-component>
<ui-bind path="currenthash" config="text"></ui-bind>
<script>
setInterval(() => location.hash = GUID(10), 1000);
ON('hash', function(hash) {
SET('currenthash', hash);
});
</script>