lucasmenendez / webproletarian

Simple WebWorkers framework for inline functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebProletarian

npm version

Simple JavaScript framework to execute inline function into a WebWorker easily.


Installation

Install with npm

npm install webproletarian

Install with yarn

yarn add webproletarian

From Source Code

Clone or download zipped source code into node_modules project folder.

git clone https://github.com/lucasmenendez/webproletarian.git <project>/node_modules/webproletarian

Documentation

Checkout the documentation.

Using WebProletarian

Import dist version into the index.html file:

<script src="/node_modules/webproletarian/dist/webproletarian.js"></script>

Or import with ES6 import:

import { WebProletarian } from 'webproletarian'

Example

import { WebProletarian } from 'webproletarian'

const labourUnion = new WebProletarian(function() {
	proletarian.read("event2", console.log);

	setInterval(() => {
		proletarian.fire("event1", "thread: ping");
	}, 1000);
});

labourUnion.read("event1", data => {
	console.log(data);
	labourUnion.fire("event2", "main: pong");
});

About

Simple WebWorkers framework for inline functions

License:Other


Languages

Language:JavaScript 94.5%Language:HTML 5.5%