Skip to content

yyx990803/workerify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Workerify

Turn the body of a function into a web worker.

Usage

var workerify = require('workerify')

var worker = workerify(function () {
	// think of here as if you are writing in a
	// separate file: you do not have access to
	// anything outside this function's scope.
    self.onmessage = function (e) {
        self.postMessage('pong')
    }
})

worker.onmessage = function (e) {
    console.log(e.data)
}

worker.postMessage('ping') // pong

About

Component for easy inline web worker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published