Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bergos/require-worker

A small AMD compatible module loader for Web Workers
https://github.com/bergos/require-worker

Last synced: about 2 months ago
JSON representation

A small AMD compatible module loader for Web Workers

Awesome Lists containing this project

README

        

# require-worker

`require-worker` is a small AMD compatible module loader for Web Workers.

## Usage

Import `require-worker` using importScripts in your worker. The script provides the `requireworker` function to load AMD modules synchronous. Here is an example:

importScripts('require-worker');
var module1 = requireworker('module1');

### r.js Optimizer

`jake-requirejs` provides a function to optimize your worker script.

jakeRequireJs.optimizeWorker('worker.build.js', {});

To import `require-worker.js` as the first file of your optimized output you need to define it as a wrapper in your build file.

wrap: { startFile: "require-worker.js" }

### License

Licensed under the Apache License, Version 2.0
()