mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 13:51:37 +08:00
Removed dependency on async.js, prepared npm publishing
This commit is contained in:
+13
-8
@@ -1,8 +1,8 @@
|
||||
/* jshint undef: true, unused: true, browser:true, devel: true */
|
||||
/* global define, vec2, importScripts */
|
||||
|
||||
define(["code_128_reader", "ean_reader", "input_stream", "image_wrapper", "barcode_locator", "barcode_decoder", "frame_grabber", "html_utils", "config", "events", "camera_access", "async", "image_debug"],
|
||||
function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, BarcodeDecoder, FrameGrabber, HtmlUtils, _config, Events, CameraAccess, async, ImageDebug) {
|
||||
define(["code_128_reader", "ean_reader", "input_stream", "image_wrapper", "barcode_locator", "barcode_decoder", "frame_grabber", "html_utils", "config", "events", "camera_access", "image_debug"],
|
||||
function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, BarcodeDecoder, FrameGrabber, HtmlUtils, _config, Events, CameraAccess, ImageDebug) {
|
||||
"use strict";
|
||||
|
||||
var _inputStream,
|
||||
@@ -223,14 +223,19 @@ function(Code128Reader, EANReader, InputStream, ImageWrapper, BarcodeLocator, Ba
|
||||
}
|
||||
|
||||
function initWorkers(cb) {
|
||||
var i;
|
||||
_workerPool = [];
|
||||
|
||||
async.times(_config.numOfWorkers, function(n, next) {
|
||||
initWorker(function(workerThread) {
|
||||
_workerPool.push(workerThread);
|
||||
next(null);
|
||||
});
|
||||
}, cb);
|
||||
for (i = 0; i < _config.numOfWorkers; i++) {
|
||||
initWorker(workerInitialized);
|
||||
}
|
||||
|
||||
function workerInitialized(workerThread) {
|
||||
_workerPool.push(workerThread);
|
||||
if (_workerPool.length >= _config.numOfWorkers){
|
||||
cb();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initWorker(cb) {
|
||||
|
||||
Vendored
-1123
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user