Digital Sovereignty for everyone

Using it in a plugin

A consuming plugin bundles the library in assets/lib/idb-keyval/ (index.js, umd.js, LICENSE) and copies snippets/lh-idb-keyval-fallback.php verbatim to includes/lh-idb-keyval-fallback.php. Never edit the copy: change the canonical snippet, bump its snippet version and recopy it everywhere. There is no Requires Plugins header, so the consumer stays independent and releasable.

What the snippet does

  • Fallback check: lh_idb_keyval_use_fallback() is true when LH idb-keyval has not fired lh_idb_keyval_registered, so a plugin turned off by its init filter counts as inactive.
  • Registration: lh_idb_keyval_register_fallback() registers the bundled copy only in that case.
  • Registry: records each plugin using its own copy, with the version, in registration order. Only the first copy registers, as a script module ID can only be registered once.
  • Site Health: one recommended test, added by whichever plugin loads the snippet first, lists those plugins and, when their versions differ, names the version every plugin is actually getting.
  • Plugins screen: each such plugin’s row shows Using bundled idb-keyval x.y.z.
  • Service workers: lh_idb_keyval_get_umd_url() returns the shared classic build when LH idb-keyval is active, otherwise the plugin’s own.

No admin notices and no debug-log output.

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.