mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 05:31:37 +08:00
Fixed static images example
This commit is contained in:
+31
-12
@@ -4814,8 +4814,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function fromConfig(config) {
|
||||
function _fromConfig(config) {
|
||||
var scanner = (0, _scanner2.default)();
|
||||
var pendingStart = null;
|
||||
var initialized = false;
|
||||
return {
|
||||
addEventListener: function addEventListener(eventType, cb) {
|
||||
scanner.subscribe(eventType, cb);
|
||||
@@ -4826,14 +4828,29 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
return this;
|
||||
},
|
||||
start: function start() {
|
||||
scanner.init(config, function (error) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
throw error;
|
||||
}
|
||||
if (scanner.isRunning()) {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
if (pendingStart) {
|
||||
return pendingStart;
|
||||
}
|
||||
if (initialized) {
|
||||
scanner.start();
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
pendingStart = new Promise(function (resolve, reject) {
|
||||
scanner.init(config, function (error) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
reject(error);
|
||||
}
|
||||
initialized = true;
|
||||
scanner.start();
|
||||
resolve();
|
||||
pendingStart = null;
|
||||
});
|
||||
});
|
||||
return this;
|
||||
return pendingStart;
|
||||
},
|
||||
stop: function stop() {
|
||||
scanner.stop();
|
||||
@@ -4896,7 +4913,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var inputConfig = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
||||
|
||||
config = (0, _config_factory.createConfigFromSource)(config, inputConfig, source);
|
||||
return fromConfig(config);
|
||||
return _fromConfig(config);
|
||||
}
|
||||
|
||||
function setConfig() {
|
||||
@@ -4919,8 +4936,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
return _fromSource(configuration, src, inputConfig);
|
||||
},
|
||||
fromConfig: function fromConfig(conf) {
|
||||
// check if source is given an return scanner
|
||||
return createApi((0, _merge4.default)({}, configuration, conf));
|
||||
return _fromConfig((0, _merge4.default)({}, configuration, conf));
|
||||
},
|
||||
decoder: function decoder(conf) {
|
||||
return setConfig(configuration, "decoder", conf);
|
||||
@@ -8947,7 +8963,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
function createScanner() {
|
||||
var _inputStream,
|
||||
_framegrabber,
|
||||
_stopped,
|
||||
_stopped = true,
|
||||
_canvasContainer = {
|
||||
ctx: {
|
||||
image: null
|
||||
@@ -9386,13 +9402,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
start: function start() {
|
||||
_start();
|
||||
},
|
||||
isRunning: function isRunning() {
|
||||
return !_stopped;
|
||||
},
|
||||
stop: function stop() {
|
||||
_stopped = true;
|
||||
adjustWorkerPool(0);
|
||||
if (_config.inputStream.type === "LiveStream") {
|
||||
_camera_access2.default.release();
|
||||
_inputStream.clearEventHandlers();
|
||||
}
|
||||
_inputStream.clearEventHandlers();
|
||||
},
|
||||
pause: function pause() {
|
||||
_stopped = true;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user