0.0.6 • Published 7 months ago

bun-plugin-comlink v0.0.6

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
7 months ago

bun-plugin-comlink

That is comlink loader for Workers in Bun.

Installation

bun add bun-plugin-comlink

Create a plugin.ts file:

import { plugin } from "bun";
import comlinkPlugin from "bun-plugin-comlink";

await plugin(comlinkPlugin());

Add plugin.ts to bunfig.toml:

preload = ["./plugin.ts"]

Usage

Create a functions.worker.ts file:

export async function sayHello() {
  return "Hello from worker!";
}

So later you can import it in your main file:

import { sayHello } from "./functions.worker";

console.log(await sayHello());

Limitations

  • You can't have sync functions with comlink

License

Apache-2.0

0.0.5

7 months ago

0.0.6

7 months ago

0.0.4

8 months ago

0.0.3

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago