Reflect Changes To localStorage

Hey @leolabs , I’ve been experimenting with the Visual Metronome feature. On several songs, the band needs it automated off on the ending of certain songs.

I’ve wrote some plugin code that can automatically enable/disable the Visual Metronome setting. This is done by modifying the value in localStorage.
But for the change to be reflected, I have to force a page refresh (not pretty). Is there an JS api that I can use to let Ableset know that localStorage has been modified?

Hey @RichardB,

There’s a global API you can use to modify device-specific settings. It’s not pretty yet, but should do the job:

deviceSettings.getState().setDeviceSettings({
  performance: {
    ...deviceSettings.getState().deviceSettings.performance, 
    showMetronome: false
  }
})

This also updates the value stored in localStorage.

Let me know if this works for you! :slight_smile:

1 Like

That’s perfect, thank you! I missed that because I was trying to figure out something from the root ableset object.