Skip to content

leafer-draw

在 WebWorker 环境中运行。

相对 @leafer-ui/worker,减少了 App 、查找元素、事件交互等功能,适用于纯绘图场景。

安装

sh
npm install @leafer-draw/worker
sh
pnpm add @leafer-draw/worker
sh
yarn add @leafer-draw/worker
sh
bun add @leafer-draw/worker

importScripts 引入

通过全局变量 LeaferUI 访问内部功能。

js
importScripts('https://unpkg.com/@leafer-draw/worker@1.0.2/dist/worker.min.js')
js
importScripts('https://unpkg.com/@leafer-draw/worker@1.0.2/dist/worker.js')

使用

使用方式、全局变量和 @leafer-ui/worker一致, 只需改下包名,即可运行官网示例代码。

Released under the MIT License.