JSPM

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

Take a snapshot of a white-web-sdk scene.

Package Exports

  • @netless/white-snapshot
  • @netless/white-snapshot/index.js
  • @netless/white-snapshot/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@netless/white-snapshot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@netless/white-snapshot

Take a snapshot of a white-web-sdk scene.

Usage

import { snapshot } from "@netless/white-snapshot";
// room = await sdk.joinRoom(...)
snapshot(room).then(canvas => {
  document.body.append(canvas);
});

Options

snapshot(room, {
  padding: 5,
  crop: null,
  html2canvas: false,
  crossorigin: false,
}): Promise<HTMLCanvasElement | null>;

Returns null if failed.

Option Type Default Description
padding number 5 Pixels to the border of canvas.
crop Rectangle null Apply crop on the snapshot. Note that the snapshot includes padding.
html2canvas boolean false Use html2canvas to print SVG directly.
crossorigin boolean false Apply hack to document.createElement('img') to enable crossorigin images.

Develop

pnpm dev

License

MIT @ netless