tutch-worker
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Tutch Worker

Build Status NPM Module

A WebWorker-friendly setup for evaluating Tutch in the browser.

Usage

The NPM module distribution contains a file, node_modules/tutch/worker.js. This file is not designed to be imported; it's designed to be used directly as a webworker. The file needs to be put at a known URL that will be used by the client.

The NPM module can be used to activate the webworker with appropriate callbacks.

import tutch from 'tutch-worker';

const requestTutch = tutch({
    url: '/node_modules/tutch-worker/worker.js', // Or wherever you put the file
    onSuccess: (just) => console.log(`Success! ${just.length} justification(s)`),
    onError: (msg, loc) => console.log(`Error ${loc ? `at line ${loc.start.line}` : ''}: ${msg}`),
});

requestTutch('this invalid string will be ignored');
requestTutch('proof a: T = begin T end;');
setTimeout(() => requestTutch('delayed invalid string will be checked, later'), 2000);

Example

If you have a version of Python that can run python -m http.server to start a HTTP server, then you can easily test Tutch in the browser. Download the tutch-worker repository, run these commands:

npm install
npm start

And then visit http://localhost:8000/ in your browser.

Readme

Keywords

none

Package Sidebar

Install

npm i tutch-worker

Weekly Downloads

1

Version

0.2.0

License

GPL-3.0

Unpacked Size

92 kB

Total Files

10

Last publish

Collaborators

  • calculemus