AbsoluteJS

Devices

absolutejs-devices-workspaceworkspacealphaNative Apps

Provider-neutral device capabilities for AbsoluteJS applications.

#Installation

BASH
git clone https://github.com/absolutejs/devices.git

#Capabilities

Overview

Provider-neutral device capabilities for AbsoluteJS applications.

The repository publishes two deliberately separate packages:

@absolutejs/devices — dependency-light contracts plus web, SSR, and test adapters.

Show 7 more

@absolutejs/devices-capacitor — Capacitor implementations selected by an AbsoluteJS mobile build.

Application code imports capabilities from @absolutejs/devices; it does not branch on Capacitor or call vendor plugins directly. AbsoluteJS selects the runtime adapter for web, SSR, tests, and installed apps.

The adapter registry is realm-scoped rather than module-scoped. This is required because an embedded page and the AbsoluteJS native shell can be compiled as independent bundles while sharing one WebView global realm.

This repository does not own emulator orchestration. Target provisioning, native builds, HMR transport, and app launch are host-side responsibilities of the AbsoluteJS mobile CLI and must never enter an application bundle.

The core implementation covers platform information, lifecycle/resume/restored operations, normalized links, network state, Android-style back events, ordinary key/value storage, clipboard, system sharing, haptics, local notifications, a portable keyboard/system-bars surface, and a deliberately separate secure-storage seam. Provider features are isolated, tree-shakeable slices: an app that never imports clipboard, share, or haptics does not need the corresponding native plugin.

AbsoluteJS discovers these named application imports at mobile initialization and reads the selected provider's declarative package metadata. It installs only the exact native plugin packages the app uses and generates the adapter wiring; application code never edits Capacitor bootstrap code. Capability discovery does not request a permission or execute native code.

Sensitive permissions are never requested by importing a module or calling a capability query. Every future permission-owning feature uses the normalized PermissionState contract and exposes an explicit requestPermission() method that applications call from a user action.

Development

The project is pre-1.0. Public contracts may change while the mobile runtime is being proven.

Repository composition

3 public packages and 0 private workspace projects are versioned and developed together.

Outcomes

What you can build

Overview

Provider-neutral device capabilities for AbsoluteJS applications.

Development

The project is pre-1.0. Public contracts may change while the mobile runtime is being proven.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed absolutejs-devices-workspace version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical absolutejs-devices-workspace example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#AbsoluteJS Devices quick start

Partial snippet

# AbsoluteJS Devices

TS
import {
  back,
  clipboard,
  haptics,
  keyboard,
  lifecycle,
  links,
  network,
  platform,
  secureStorage,
  share,
  systemBars,
} from "@absolutejs/devices";

const info = await platform.info();
const launchLink = await links.getLaunchLink();
const connection = await network.status();

const removeResume = await lifecycle.onResume(() => {
  // Refresh ephemeral UI. Durable application synchronization belongs to
  // @absolutejs/sync rather than the device lifecycle adapter.
});

if ((await back.capability()).available) {
  const removeBack = await back.onPress(({ canGoBack }) => {
    if (canGoBack) history.back();
  });
}

if ((await secureStorage.capability()).available) {
  await secureStorage.set("credential", "provider-owned-secret");
}

await clipboard.writeText("Copied everywhere");
await share.share({ text: "Shared everywhere", url: "https://absolutejs.com" });
await haptics.impact("light");
await keyboard.dismiss();
await systemBars.setAppearance("light", "status");

#Development

Partial snippet

Working example for Development.

BASH
bun install
bun run check

#Workspace contents

3 public packages and 0 private workspace projects are maintained in this repository.

#Package commands

Scripts declared by this project’s package manifest.

bun run buildbun run --cwd packages/devices build && bun run --cwd packages/devices-capacitor build && bun run --cwd packages/devices-expo build
bun run checkbun run typecheck && bun test && bun run build && bun run verify:dist
bun run formatprettier --write .
bun run testbun test
bun run typecheckbun run --filter '@absolutejs/devices*' typecheck
Workspace project
This workspace project is not published as a standalone npm package. Use its repository and the accurately labeled public or private workspace contents below.