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

@wrnexus/mobile

SSR-safe access to Capacitor plugins from WrNexus browser code.

wrnexus mobile add @capacitor/camera
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.