JSPM

@whoisahmad/baseline-tools-helpers

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q20427F
  • License MIT

Tiny capability checks for Baseline guards (share, canParse, view transitions, file picker).

Package Exports

  • @whoisahmad/baseline-tools-helpers

Readme

@baseline-tools/helpers

Tiny capability checks to help adopt modern web features safely.

  • canShare()navigator.share
  • canParseUrl(url) — uses URL.canParse if available, otherwise new URL()
  • hasViewTransitions()document.startViewTransition
  • canShowOpenFilePicker()window.showOpenFilePicker

Install:

npm i @baseline-tools/helpers

Use:

import { canShare } from "@baseline-tools/helpers";

if (canShare()) {
  await navigator.share({ title: document.title, url: location.href });
} else {
  // fallback UI
}