The web fallback

webBridge() is the bridge for a plain browser build, and it passes the same contract suite as every native shell. That is what keeps the web build working: the game calls one API everywhere, and on the web it gets this.

import { createNative, webBridge } from 'tosijs-native'
import config from './tosijs-native.config'

const native = await createNative(config, webBridge())

capabilities is the config's capabilities. Pass it and the bridge refuses what the config does not declare, exactly as a native shell does; leave it out and nothing is refused, which suits a page that has no config to hand. On the web the gate protects nothing (the page is the app), so it exists to make a mistake fail in the browser too, before it fails in a shell.

storage, document, navigator and window default to the globals; pass memoryStorage() for a bridge that forgets everything when the page closes.

Storage keys are namespaced (namespace defaults to tosijs-native), and the bridge's own records are kept apart from game saves, so store.keys lists only what the game wrote.

memoryStorage

The slice of localStorage the bridge uses, backed by a Map. Also what the bridge falls back to.