Digital Sovereignty for everyone

Architecture

One class, LH_Idb_Keyval, in the main file. On init priority 0 it registers the idb-keyval script module from assets/lib/index.js, versioned with the plugin version, then fires lh_idb_keyval_registered. Consuming plugins test that action to decide whether to fall back to their own copy.

Files

  • assets/lib/index.js: the library’s ES module build, verbatim from the npm package.
  • assets/lib/umd.js: an unminified classic build for service workers and classic scripts. It defines the idbKeyval global. Upstream only publishes a minified one, so this is the ES module build wrapped in a UMD factory, with the library code unchanged.
  • assets/lib/LICENSE: the library’s Apache-2.0 licence.
  • snippets/lh-idb-keyval-fallback.php: the canonical fallback snippet for consuming plugins. This plugin never loads it.

Public methods

  • get_umd_url(): URL of the classic build, with a ver query string so a library update busts service worker and HTTP caches.
  • get_module_url(): URL of the ES module build.
  • return_module_id(): always idb-keyval. Not filterable, because consumers import by that name and the snippet registers under it.

Updating the library

Replace index.js from the new npm release, regenerate umd.js by wrapping it the same way, and release with bump_version set to the library version. This plugin retires with the library.

If you like this plugin please consider making a donation to further development

Install LHero.org

lhero.org

Open it straight from your home screen, full screen and quicker to load.

  1. Tap the Share button . If you cannot see it, tap ••• first.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add.
  1. Tap the browser menu â‹®.
  2. Tap Install app or Add to Home screen.
  1. In the menu bar, choose File, then Add to Dock.

Use your browser's menu to install this site or add it to your home screen.