Skip to content

Commit

Permalink
import with cors
Browse files Browse the repository at this point in the history
  • Loading branch information
antimatter15 committed Oct 8, 2016
1 parent 16d9e9d commit c2a06b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dist/tesseract.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ exports.defaultOptions = {
};

exports.spawnWorker = function spawnWorker(instance, workerOptions) {
var worker = new Worker(workerOptions.workerPath);
if (window.Blob && window.URL) {
var blob = new Blob(['importScripts("' + workerOptions.workerPath + '");']);
var worker = new Worker(window.URL.createObjectURL(blob));
} else {
var worker = new Worker(workerOptions.workerPath);
}

worker.onmessage = function (e) {
var packet = e.data;
instance._recv(packet);
Expand Down

0 comments on commit c2a06b4

Please sign in to comment.