Files
WRNexusJS/.publish/mobile/README.md
T
2026-07-12 15:55:18 +05:30

25 lines
719 B
Markdown

# @wrnexus/mobile
SSR-safe access to Capacitor plugins from WrNexus browser code.
```bash
wrnexus mobile add @capacitor/camera
```
```ts
import { Camera } from "@capacitor/camera";
import { mobile } from "@wrnexus/mobile";
if (mobile.isNative()) {
mobile.registerPlugin("Camera", Camera);
const photo = await mobile.invoke("Camera", "getPhoto", { resultType: "uri" });
}
```
`isNative()` is false and `platform()` is `web` during SSR. `plugin()` returns
`undefined` when unavailable; `requirePlugin()` and `invoke()` throw an
actionable `MobileUnavailableError`.
Import and register Capacitor packages only from browser-owned code. Do not
import them in server routes, SSR helpers, or other Bun-only modules.