56 lines
4.6 KiB
Plaintext
56 lines
4.6 KiB
Plaintext
page wrnexusnative {
|
|
seo {
|
|
title = "@wrnexus/native"
|
|
description = "Cross-platform browser and Capacitor capability registry."
|
|
}
|
|
|
|
view {
|
|
<div class="docs-shell">
|
|
<header class="topbar">
|
|
<a class="brand" href="/"><span>W</span> WRNexusJS</a>
|
|
<nav><a href="/getting-started">Get started</a><a href="/packages">Packages</a><a href="/language">Language</a><a href="/architecture">Architecture</a></nav>
|
|
<button data-wire-theme-toggle class="theme-button" aria-label="Toggle theme">Theme</button>
|
|
</header>
|
|
<main class="page package-page">
|
|
<aside class="sidebar"><a href="/packages">← All packages</a><span class="category">Native</span><h1>@wrnexus/native</h1><p>Cross-platform browser and Capacitor capability registry.</p><code>bun add @wrnexus/native@0.2.14</code><nav><a href="#guide">Guide</a><a href="#api">Complete API</a></nav></aside>
|
|
<article class="documentation"><section class="doc-intro"><span class="eyebrow">Native</span><h1>@wrnexus/native</h1><p>Cross-platform browser and Capacitor capability registry.</p><pre><code>bun add @wrnexus/native@0.2.14</code></pre></section><section id="guide" class="prose"><p>Cross-platform capabilities for browsers, Capacitor WebViews, and compiled native apps.</p>
|
|
<pre data-language="ts"><code>import { native } from "@wrnexus/native";
|
|
|
|
if (native.supports("share")) await native.run("share", { title: "WRNexusJS", url: location.href });</code></pre>
|
|
<p>Built-ins include <code>camera</code>, <code>clipboard.write</code>, <code>share</code>, <code>geolocation</code>, <code>network</code>, <code>haptics</code>, storage, filesystem, notifications, and device information. Browser capabilities use Web APIs; mobile capabilities use installed Capacitor plugins.</p>
|
|
<p><code>platform()</code> returns <code>server</code> during SSR, <code>browser</code> on the web, and the Capacitor platform in a native WebView. Unsupported operations reject with <code>NativeUnavailableError</code>; use <code>supports()</code> before presenting optional UI.</p></section><section id="api" class="prose api"><h2>Complete TypeScript API</h2><p>This declaration is generated from the exact published package and lists its exported functions, classes, interfaces, and types.</p><pre data-language="typescript"><code>import { N as NativePlatform, a as NativeCapability, b as NativeRunOptions, c as NativeTarget } from './types-CDShWg0i.js';
|
|
export { d as NativeAdapter, e as NativeBrowserRuntime } from './types-CDShWg0i.js';
|
|
export { browserCapabilities } from './browser.js';
|
|
export { mobileCapabilities } from './mobile.js';
|
|
|
|
declare class NativeUnavailableError extends Error {
|
|
constructor(message: string);
|
|
}
|
|
declare function isMobile(): boolean;
|
|
declare function platform(): NativePlatform;
|
|
declare function register<TOptions = unknown, TResult = unknown>(name: string, capability: NativeCapability<TOptions, TResult>): () => void;
|
|
declare function registered(): string[];
|
|
declare function supports(name: string, target?: NativeTarget): boolean;
|
|
declare function run<TResult = unknown>(name: string, options?: unknown, runOptions?: NativeRunOptions): Promise<TResult>;
|
|
declare function clearRegistry(): void;
|
|
|
|
declare const native: {
|
|
isMobile: typeof isMobile;
|
|
platform: typeof platform;
|
|
register: typeof register;
|
|
registered: typeof registered;
|
|
run: typeof run;
|
|
supports: typeof supports;
|
|
};
|
|
|
|
export { NativeCapability, NativePlatform, NativeRunOptions, NativeTarget, NativeUnavailableError, clearRegistry, isMobile, native, platform, register, registered, run, supports };
|
|
</code></pre></section><section id="examples" class="prose examples"><h2>Examples</h2><p>Copy-ready examples taken from this package's published documentation.</p><div class="example-grid"><article class="example-card"><h3>Example 1</h3><pre data-language="ts"><code>import { native } from "@wrnexus/native";
|
|
|
|
if (native.supports("share")) await native.run("share", { title: "WRNexusJS", url: location.href });</code></pre></article></div></section></article>
|
|
<aside class="on-this-page"><h2>On this page</h2><nav><a class="toc-level-2" href="#guide">Guide</a><a class="toc-level-2" href="#api">Complete API</a><a class="toc-level-2" href="#examples">Examples</a></nav></aside>
|
|
</main>
|
|
<footer>WRNexusJS 0.2.14 · SSR-first · Bun-native · Documentation generated from published package APIs.</footer>
|
|
</div>
|
|
}
|
|
}
|