@livx.cc/native-kit
v0.35.0
Published
Isomorphic native-capabilities kit for PWAs — same API in browser and in an appwrap native shell. Zero dependencies.
Downloads
2,984
Maintainers
Readme
@livx.cc/native-kit
Isomorphic native-capabilities kit for PWAs — the same API in the browser and inside an appwrap native shell. Zero dependencies.
bun add @livx.cc/native-kit # or: npm i @livx.cc/native-kitimport { kit } from '@livx.cc/native-kit';
await kit.haptics.impact('medium'); // native vibration in the shell, no-op/web-fallback in a browser
const photo = await kit.photos.pick(); // native picker on device, <input type=file> on webAnalytics context
kit.context() returns one flat, vendor-neutral property bag (client taxonomy, app version/build, install source, device, push permission, …) — spread it straight into your analytics super-properties. Native-only fields degrade gracefully on web. First-party & non-tracking: the install id is iOS IDFV / an Android UUID, never IDFA/GAID.
import { kit } from '@livx.cc/native-kit';
mixpanel.register(await kit.context());
// → { client: 'native-ios', platform: 'ios', app_version: '1.0.3',
// install_source: 'testflight', device_model: 'iPhone15,3', push_permission: 'granted', … }The kit detects whether it's running inside the appwrap shell and routes each call to the native bridge or a web fallback, so a single web build works everywhere. Capabilities advertise their real backing (native / web / none) so your UI can be honest about what's available.
Covers haptics, share, storage, notifications, OAuth, billing (IAP), health, geo, camera, photos, contacts, calendar, motion, reviews, tracking (iOS App Tracking Transparency), and more.
Full documentation, capability model, and the bridge protocol: see the appwrap README.
License
MIT © Elya Livshitz
