@ -34,12 +34,11 @@ Or you can grab copies of `tesseract.js` and `worker.js` from the [dist folder](
@@ -34,12 +34,11 @@ Or you can grab copies of `tesseract.js` and `worker.js` from the [dist folder](
// from now on use LocalTesseract instead of Tesseract
</script>
```
@ -156,8 +155,8 @@ In NodeJS, an image can be
@@ -156,8 +155,8 @@ In NodeJS, an image can be
## TesseractJob
A TesseractJob is an an object returned by a call to recognize or detect.
All methods of a given TesseractJob return that TesseractJob to enable chaining.
A TesseractJob is an an object returned by a call to `recognize` or `detect`. It's inspired by the ES6 Promise interface and provides `then` and `catch` methods. One important difference is that these methods return the job itself (to enable chaining) rather than new.
// when when somebody has screwed with setTimeout but no I.E. maddness
returncachedSetTimeout(fun,0);
}catch(e){
try{
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
returncachedSetTimeout.call(null,fun,0);
}catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
returncachedSetTimeout.call(this,fun,0);
}
}
}
functionrunClearTimeout(marker){
if(cachedClearTimeout===clearTimeout){
//normal enviroments in sane situations
returnclearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
// when when somebody has screwed with setTimeout but no I.E. maddness
returncachedClearTimeout(marker);
}catch(e){
try{
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
returncachedClearTimeout.call(null,marker);
}catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
returncachedClearTimeout.call(this,marker);
}
}
}
varqueue=[];
vardraining=false;
varcurrentQueue;
varqueueIndex=-1;
functioncleanUpNextTick(){
if(!draining||!currentQueue){
return;
}
draining=false;
if(currentQueue.length){
queue=currentQueue.concat(queue);
}else{
queueIndex=-1;
}
if(queue.length){
drainQueue();
}
}
functiondrainQueue(){
if(draining){
return;
}
vartimeout=runTimeout(cleanUpNextTick);
draining=true;
varlen=queue.length;
while(len){
currentQueue=queue;
queue=[];
while(++queueIndex<len){
if(currentQueue){
currentQueue[queueIndex].run();
}
}
queueIndex=-1;
len=queue.length;
}
currentQueue=null;
draining=false;
runClearTimeout(timeout);
}
process.nextTick=function(fun){
varargs=newArray(arguments.length-1);
if(arguments.length>1){
for(vari=1;i<arguments.length;i++){
args[i-1]=arguments[i];
}
}
queue.push(newItem(fun,args));
if(queue.length===1&&!draining){
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
functionItem(fun,array){
this.fun=fun;
this.array=array;
}
Item.prototype.run=function(){
this.fun.apply(null,this.array);
};
process.title='browser';
process.browser=true;
process.env={};
process.argv=[];
process.version='';// empty string to avoid regexp issues
process.versions={};
functionnoop(){}
process.on=noop;
process.addListener=noop;
process.once=noop;
process.off=noop;
process.removeListener=noop;
process.removeAllListeners=noop;
process.emit=noop;
process.binding=function(name){
thrownewError('process.binding is not supported');