Files
WRNexusJSDoc/app/pages/packages/native.wrn
T
2026-07-12 16:14:06 +05:30

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.12</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.12</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 &#123; native &#125; from &quot;@wrnexus/native&quot;;
if (native.supports(&quot;share&quot;)) await native.run(&quot;share&quot;, &#123; title: &quot;WRNexusJS&quot;, url: location.href &#125;);</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 &#123; N as NativePlatform, a as NativeCapability, b as NativeRunOptions, c as NativeTarget &#125; from './types-CDShWg0i.js';
export &#123; d as NativeAdapter, e as NativeBrowserRuntime &#125; from './types-CDShWg0i.js';
export &#123; browserCapabilities &#125; from './browser.js';
export &#123; mobileCapabilities &#125; from './mobile.js';
declare class NativeUnavailableError extends Error &#123;
constructor(message: string);
&#125;
declare function isMobile(): boolean;
declare function platform(): NativePlatform;
declare function register&lt;TOptions = unknown, TResult = unknown&gt;(name: string, capability: NativeCapability&lt;TOptions, TResult&gt;): () =&gt; void;
declare function registered(): string[];
declare function supports(name: string, target?: NativeTarget): boolean;
declare function run&lt;TResult = unknown&gt;(name: string, options?: unknown, runOptions?: NativeRunOptions): Promise&lt;TResult&gt;;
declare function clearRegistry(): void;
declare const native: &#123;
isMobile: typeof isMobile;
platform: typeof platform;
register: typeof register;
registered: typeof registered;
run: typeof run;
supports: typeof supports;
&#125;;
export &#123; NativeCapability, NativePlatform, NativeRunOptions, NativeTarget, NativeUnavailableError, clearRegistry, isMobile, native, platform, register, registered, run, supports &#125;;
</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 &#123; native &#125; from &quot;@wrnexus/native&quot;;
if (native.supports(&quot;share&quot;)) await native.run(&quot;share&quot;, &#123; title: &quot;WRNexusJS&quot;, url: location.href &#125;);</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.12 · SSR-first · Bun-native · Documentation generated from published package APIs.</footer>
</div>
}
}