mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-20 05:29:17 +00:00

* feat: add a headless extension template * feat: add headless template support for create-kunkun package * chore: bump create-kunkun version to 0.1.38
19 lines
418 B
TypeScript
19 lines
418 B
TypeScript
import { clipboard, expose, HeadlessWorkerExtension, toast } from "@kksh/api/headless"
|
|
import { v4 as uuidv4 } from "uuid"
|
|
|
|
class UuidExt extends HeadlessWorkerExtension {
|
|
async load() {
|
|
const uuid = uuidv4()
|
|
return clipboard
|
|
.writeText(uuid)
|
|
.then(() => {
|
|
toast.success(`Copied UUID: ${uuid}`)
|
|
})
|
|
.catch((err) => {
|
|
toast.error(`Failed to copy UUID: ${err}`)
|
|
})
|
|
}
|
|
}
|
|
|
|
expose(new UuidExt())
|