@flourish/url-state
v2.0.0
Published
Enables dynamic state from the URL hash
Downloads
29
Maintainers
Keywords
Readme
Flourish url state
How to install
npm install -s @flourish/url-state
Add to the state with:
url_state: {}
Add the settings to the bottom of the settings in the template.yml
with:
- URL settings
- property: url_state
import: "@flourish/url-state"
Usage
Import it & initialise, typically at the top of the draw
function, passing in the module state, the template's state and the callback. For example:
import initURLState from "@flourish/url-state";
// ...
function draw() {
initURLState(state.url_state, state, update);
// ...
URL state won't be accessible until it has been enabled in the theme using: url_state.enabled: true
.
One this is enabled, the user can add state to the visualization's URL as URL-encoded JSON.