Enables dynamic state from the URL hash
npm install @flourish/url-statenpm install -s @flourish/url-state
Add to the state with:
``js`
url_state: {}
Add the settings to the bottom of the settings in the template.yml with:
`yml`
- URL settings
- property: url_state
import: "@flourish/url-state"
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:
`js
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.