@lumate/lumo-sdk
v1.1.0
Published
Typed SDK for Lumo mini-programs — a thin wrapper over the injected window.Lumo bridge.
Readme
@lumate/lumo-sdk
The typed SDK for Lumo mini-programs. It's a thin wrapper over the
window.Lumo bridge the Lumo app injects into every mini-program's WebView —
so you develop against a real import with full autocomplete instead of poking
at window.
npm i @lumate/lumo-sdkimport Lumo from '@lumate/lumo-sdk'
const { openId, user } = await Lumo.login()
const info = await Lumo.getSystemInfo()
const res = await Lumo.request({ url: 'https://api.example.com/data' })
await Lumo.storage.set('key', 'value')When run outside the Lumo app (e.g. previewing a page in a desktop browser),
calls throw a clear error. Guard with isLumoAvailable() if you need to
degrade gracefully:
import Lumo, { isLumoAvailable } from '@lumate/lumo-sdk'
if (isLumoAvailable()) await Lumo.showToast('hi')Plain-HTML developers (no bundler) can keep using the injected global directly — it's typed too:
<script>
const info = await window.Lumo.getSystemInfo()
</script>Available capabilities depend on your manifest.json permissions (and, for
request(), your requestDomains). Calling a method whose scope wasn't
granted rejects with an error. Full API, manifest spec and permission scopes:
https://www.lumate.my/developers.
