0.0.4 • Published 1 year ago

valuescript v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

ValueScript

About the language

This module

This is a module for running ValueScript in JavaScript.

ValueScript is in early development and this module is especially unlikely to be useful externally right now. Please drop me a line if you want to see this improved :).

It's possible you will find the lower level WorkerPool and WorkerSlot utilities useful:

import { WorkerPool } from 'valuescript';

function task() {
  console.log('Hi from pool');
}

const script = [
  'self.postMessage("ready");',
  task.toString(),
  'task();',
].join('\n\n');

const scriptUrl = URL.createObjectURL(
  new Blob([script], { type: 'application/javascript' }),
);

const pool = new WorkerPool(scriptUrl);

pool.use(async (worker, terminate) => {
  // Exclusive access to worker
  // terminate() terminates the worker and leads to the creation of a new one
  // for use by other consumers
});
0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago