Browse Source

Merge pull request #98 from trevorwhealy/error_create_not_found

fix(webpack/error): create not found error when compiled with webpack
pull/246/head
jeromewu 6 years ago committed by GitHub
parent
commit
281b59fe26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/index.js

6
src/index.js

@ -3,7 +3,7 @@ const circularize = require('./common/circularize.js')
const TesseractJob = require('./common/job'); const TesseractJob = require('./common/job');
const version = require('../package.json').version; const version = require('../package.json').version;
function create(workerOptions = {}){ const create = function(workerOptions = {}){
var worker = new TesseractWorker(Object.assign({}, adapter.defaultOptions, workerOptions)); var worker = new TesseractWorker(Object.assign({}, adapter.defaultOptions, workerOptions));
worker.create = create; worker.create = create;
worker.version = version; worker.version = version;
@ -22,7 +22,7 @@ class TesseractWorker {
return this._delay(job => { return this._delay(job => {
if (typeof options === 'string') options = {lang: options} if (typeof options === 'string') options = {lang: options}
options.lang = options.lang || 'eng'; options.lang = options.lang || 'eng';
job._send('recognize', { image, options, workerOptions: this.workerOptions }); job._send('recognize', { image, options, workerOptions: this.workerOptions });
}) })
} }
@ -32,7 +32,7 @@ class TesseractWorker {
}) })
} }
terminate(){ terminate(){
if(this.worker) adapter.terminateWorker(this); if(this.worker) adapter.terminateWorker(this);
this.worker = null; this.worker = null;
this._currentJob = null; this._currentJob = null;

Loading…
Cancel
Save