workered

3.0.0 • Public • Published

Workered

DO NOT CONFUSE WITH WORKERD by CLOUDFLARE

Call in the client with

import { Thread } from "workered";
const w = new Thread( "worker.ts" );

// (<func>, param[])
w.run( "fib", [ 10 ] ).then( res =>
  console.log("Fibonacci of 10 is", res)
);

And in the worker file

import { Host } from "workered";
function fib (n: number): number {/*Calculate Fibonacci*/};
async function todo (msg: string): Promise<string> {/*Do something*/};

new Host()
  .register("fib", fib)
  .register("todo", todo);

Notes

  • Params must be string | number | boolean

Readme

Keywords

none

Package Sidebar

Install

npm i workered

Weekly Downloads

0

Version

3.0.0

License

MIT

Unpacked Size

4.29 kB

Total Files

8

Last publish

Collaborators

  • plutoniumm