webf_share library

WebF Share module for sharing content, text, and images

This module provides functionality to:

  • Share images with text and subject
  • Share text content and URLs
  • Save screenshots to device storage
  • Create preview images for display

Example usage:

// Register module globally (in main function)
WebF.defineModule((context) => ShareModule(context));

JavaScript usage with npm package (Recommended):

npm install @openwebf/webf-share
import { WebFShare, ShareHelpers } from '@openwebf/webf-share';

// Share text
await WebFShare.shareText({
  title: 'My App',
  text: 'Check out this amazing content!',
  url: 'https://example.com'
});

// Share image
const canvas = document.querySelector('canvas');
const imageData = await ShareHelpers.canvasToArrayBuffer(canvas);
await WebFShare.shareImage({
  imageData,
  text: 'Check this out!',
  subject: 'Amazing Content'
});

// Save screenshot
const result = await WebFShare.saveScreenshot({
  imageData,
  filename: 'my_screenshot'
});

Direct module invocation (Legacy):

await webf.invokeModuleAsync('Share', 'share', 
  imageBytes, 'Check this out!', 'Amazing Content'
);

Classes

ShareModule
WebF module for sharing content, text, and images