ump-plugin-share
v0.0.1
Published
UMP Share — OS share sheet (web navigator.share shape)
Readme
ump-plugin-share
UMP Share — OS share sheet, in the web navigator.share / navigator.canShare
shape.
Install
npm install ump-plugin-share --save
Usage
import { Share, sharePlugin } from 'ump-plugin-share';
pm.register(sharePlugin());
await Share.share({ title: 'Cool article', text: 'You should read this', url: 'https://example.com/post/42', });
if (Share.canShare({ url: 'https://example.com' })) { // OK to invoke share() }
v1 supports title, text, url. The files field is accepted at the
type level for source compatibility with web code, but is dropped (with a
one-shot console.warn) before the payload reaches the native bridge —
file sharing across the JSI boundary needs design work that hasn't shipped.
The native side registers a single __ump_share host function that takes
a JSON payload and resolves with a JSON ShareResult
({ ok, reason?: 'cancelled' | 'unsupported' | 'error', message? }).
See src/index.ts for the full API.
Plugin authoring
This is a UMP plugin. See docs/superpowers/specs/plugin-authoring-guide.md for the plugin model.
