<commit_before>webwork.js
=======

Execute Web Workers without external files

Usage is as really simple:

```javascript
callableWebworker = webwork(callback);
```
`callback` takes a single data argument and should return the result  
`callableWebworker` is a function that takes the data to send and  
a node style callback ie `function(err, result) {}`

## [JSBin Demo](http://jsfiddle.net/uqcFM/60/)

## Example
```javascipt
var goodWorker = webwork(function (data) {
    return "!!" + data  + "!!";
});
var badWorker = webwork(function (data) {
    return "!!" + data + imNotDefined + "!!";
});

goodWorker("Test123", function(err, result) {
    if (err) return alert("goodWorker Errored with " + err.message);
    alert("first goodWorker returned with " + result);
});
goodWorker("Test123", function(err, result) {
    if (err) return alert("goodWorker Errored with " + err.message);
    alert("second goodWorker returned with " + result);
});
badWorker("Test456", function(err, result) {
    if (err) return alert("badWorker Errored with " + err.message);
    alert("badWorker returned with " + result);
});
alert("Since webworkers are async this should happen first.\nThe callbacks may fire in any order");
```

The astute may realize that they can access the `event` variable inside the callback.  
Also since the callback is stringified and injected into the webworker, you don't have access to any vars in scope<commit_msg>Add Usage Section to README<commit_after>webwork.js
=======

Execute Web Workers without external files

Usage is as really simple:

```javascript
callableWebworker = webwork(callback);
```
`callback` takes a single data argument and should return the result  
`callableWebworker` is a function that takes the data to send and  
a node style callback ie `function(err, result) {}`

## [JSBin Demo](http://jsfiddle.net/uqcFM/60/)

## Example
```javascipt
var goodWorker = webwork(function (data) {
    return "!!" + data  + "!!";
});
var badWorker = webwork(function (data) {
    return "!!" + data + imNotDefined + "!!";
});

goodWorker("Test123", function(err, result) {
    if (err) return alert("goodWorker Errored with " + err.message);
    alert("first goodWorker returned with " + result);
});
goodWorker("Test123", function(err, result) {
    if (err) return alert("goodWorker Errored with " + err.message);
    alert("second goodWorker returned with " + result);
});
badWorker("Test456", function(err, result) {
    if (err) return alert("badWorker Errored with " + err.message);
    alert("badWorker returned with " + result);
});
alert("Since webworkers are async this should happen first.\nThe callbacks may fire in any order");
```

The astute may realize that they can access the `event` variable inside the callback.  
Also since the callback is stringified and injected into the webworker, you don't have access to any vars in scope

## What to Use webwork.js for and When to Use It
webwork.js is best used for any project that requires web workers, but needs to minimize or eleminate external web worker files. It also allows for simpler, cleaner inline web worker code. webwork.js should be used when a project: 
- needs web workers, but wants to keep web worker code inline for minification and distribution purposes
- needs web workers, but wants to keep web worker code inline to avoid excessive external web worker files and page requests
- needs inline web workers, and wants to avoid repetitive and tedious [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) code




{'fraction_non_alphanumeric': 0.11236909142371922, 'fraction_numerical': 0.006227002547410133, 'mean_word_length': 4.5829383886255926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '848015', 'n_tokens_mistral': 1018, 'n_tokens_neox': 967, 'n_words': 407}