Persistent local storage option for Client scripts


This module enables Client scripts to store key/value strings using a subset of the localStorage Web API.

This is similar to using the built-in HiFi Settings API, but uses Qt WebEngineView to save values independently of Interface.ini.

In most scenarios the built-in Settings API should still be used – because most of the time being able to reset everything in one place is a good thing. Except when it’s not… in which case this solution could be used instead.

Please see the Gist’s README.MD for latest version and examples.

API overview:

To use via CDN:




var KEY = 'my-script-position';

localStorage.$ready(function() {
  localStorage.setItem(KEY, JSON.stringify(MyAvatar.position));
  var value = localStorage.getItem(KEY),
      pos = JSON.parse(value);
  print(KEY, value);

See localStorage.js for more info about where the data gets stored locally.