npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ankhorage/permissions

v0.2.0

Published

Cross-platform permission registry and runtime helpers for TypeScript apps, with unified request/check APIs for camera, media, location, notifications, microphone, etc. and web/native capabilities.

Readme

PERMISSIONS

license: MIT npm: v0.1.1 runtime: bun typescript: strict eslint: checked prettier: checked build: checked tests: checked docs: paradox

Cross-platform permission registry and runtime helpers for TypeScript apps, with unified request/check APIs for camera, media, location, notifications, microphone, etc. and web/native capabilities.

Usage

Basic permissions runtime example.

Create a permission client, provide it at the app root, and use usePermission to read, refresh, and request a normalized permission state.

Source: examples/basic/App.tsx

import {
  createFakePermissionClient,
  Permission,
  PermissionsProvider,
  usePermission,
} from '@ankhorage/permissions';

const permissionClient = createFakePermissionClient({
  initialStates: [{ permission: Permission.Camera, status: 'denied' }],
  requestStates: [{ permission: Permission.Camera, status: 'granted' }],
});

export default function BasicPermissionsExample() {
  return (
    <PermissionsProvider client={permissionClient}>
      <CameraPermissionExample />
    </PermissionsProvider>
  );
}

function CameraPermissionExample() {
  const camera = usePermission(Permission.Camera, { refreshOnMount: true });

  return (
    <>
      <p>Camera permission: {camera.status}</p>
      <button
        type="button"
        disabled={camera.granted}
        onClick={() => {
          void camera.request();
        }}
      >
        Request camera permission
      </button>
    </>
  );
}

Expo permissions runtime example.

Create the Expo permission client from the optional Expo entrypoint, provide it at the app root, and call request() only from an explicit user action.

Source: examples/expo/App.tsx

import { Permission, PermissionsProvider, usePermission } from '@ankhorage/permissions';
import { createPermissionClient } from '@ankhorage/permissions/expo';

const permissionClient = createPermissionClient();

export default function ExpoPermissionsExample() {
  return (
    <PermissionsProvider client={permissionClient}>
      <CameraPermissionExample />
    </PermissionsProvider>
  );
}

function CameraPermissionExample() {
  const camera = usePermission(Permission.Camera, { refreshOnMount: true });

  return (
    <>
      <p>Camera permission: {camera.status}</p>
      <button
        type="button"
        disabled={camera.granted}
        onClick={() => {
          void camera.request();
        }}
      >
        Request camera permission
      </button>
    </>
  );
}

Generated documentation

Public API

Utilities

createFakePermissionClient(options?: FakePermissionClientOptions) => FakePermissionClient

Creates a deterministic in-memory client for tests and examples.

Fake clients make permission flows testable without native devices, browser prompts, simulators, or network access.

Module: src/testing/index.ts Source: src/testing/index.ts:55:1 Related symbols: FakePermissionClient, FakePermissionClientOptions

createPermissionManager(client: PermissionClient) => PermissionManager

Creates a permission manager from a runtime-specific client.

The manager validates permission names and normalizes client results. Native app configuration remains a separate build-time concern.

Module: src/manager/createPermissionManager.ts Source: src/manager/createPermissionManager.ts:21:1 Related symbols: PermissionClient, PermissionManager

createWebPermissionClient(options?: WebPermissionClientOptions) => PermissionClient

Creates a browser permission client using guarded structural globals.

Unsupported web APIs resolve to status: 'unavailable'. The adapter does not import DOM types and does not assume it is running in a browser.

Module: src/web/index.ts Source: src/web/index.ts:78:1 Related symbols: PermissionClient, WebPermissionClientOptions

Common runtime permissions supported by the registry.

The registry is intentionally platform-neutral. Adapters translate each permission into whatever a browser, React Native app, Expo app, or test environment can actually check or request.

Module: src/registry/permissions.ts Source: src/registry/permissions.ts:9:1

PermissionsProvider({
  children,
  client,
  manager,
}: PermissionsProviderProps) => ReactNode

Provides a permission manager to React hooks.

React helpers are framework-neutral. They depend on React only and do not import browser, Expo, or React Native permission APIs.

Related types: PermissionsProviderProps

| Prop | Type | Required | Default | Description | | -------- | -------------------------------- | -------- | ------- | ----------- | | children | ReactNode \| undefined | no | — | | | client | PermissionClient \| undefined | no | — | | | manager | PermissionManager \| undefined | no | — | |