Browse Source

import with cors

pull/12/head 0.1.2
Kevin Kwok 8 years ago
parent
commit
c2a06b4b12
  1. 8
      dist/tesseract.js

8
dist/tesseract.js vendored

@ -9,7 +9,13 @@ exports.defaultOptions = { @@ -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);

Loading…
Cancel
Save