mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 05:31:37 +08:00
Remove console-messages for production build
This commit is contained in:
@@ -104,6 +104,12 @@ file is only valid for the non-uglified version `quagga.js` because the
|
||||
minified version is altered after compression and does not align with the map
|
||||
file any more.
|
||||
|
||||
### Node
|
||||
|
||||
The code in the `dist` folder is only targeted to the browser and won't work in
|
||||
node due to the dependency on the DOM. For the use in node, the `build` command
|
||||
also creates a `quagga.js` file in the `lib` folder.
|
||||
|
||||
## <a name="api">API</a>
|
||||
|
||||
You can check out the [examples][github_examples] to get an idea of how to
|
||||
@@ -545,6 +551,13 @@ on the ``singleChannel`` flag in the configuration when using ``decodeSingle``.
|
||||
|
||||
## <a name="changelog">Changelog</a>
|
||||
|
||||
### 2016-02-18
|
||||
|
||||
- Internal Changes
|
||||
- Restructuring into meaningful folders
|
||||
- Removing debug-code in production build
|
||||
|
||||
|
||||
### 2016-02-15
|
||||
Take a look at the release-notes ([0.9.0]
|
||||
(https://github.com/serratus/quaggaJS/releases/tag/v0.9.0))
|
||||
|
||||
@@ -82,12 +82,16 @@ export default {
|
||||
} else if (typeof readerConfig === 'string') {
|
||||
reader = readerConfig;
|
||||
}
|
||||
console.log("Before registering reader: ", reader);
|
||||
if (ENV.development) {
|
||||
console.log("Before registering reader: ", reader);
|
||||
}
|
||||
_barcodeReaders.push(new READERS[reader](configuration));
|
||||
});
|
||||
console.log("Registered Readers: " + _barcodeReaders
|
||||
.map((reader) => JSON.stringify({format: reader.FORMAT, config: reader.config}))
|
||||
.join(', '));
|
||||
if (ENV.development) {
|
||||
console.log("Registered Readers: " + _barcodeReaders
|
||||
.map((reader) => JSON.stringify({format: reader.FORMAT, config: reader.config}))
|
||||
.join(', '));
|
||||
}
|
||||
}
|
||||
|
||||
function initConfig() {
|
||||
|
||||
@@ -27,7 +27,9 @@ function loadedData(video, callback) {
|
||||
function checkVideo() {
|
||||
if (attempts > 0) {
|
||||
if (video.videoWidth > 0 && video.videoHeight > 0) {
|
||||
console.log(video.videoWidth + "px x " + video.videoHeight + "px");
|
||||
if (ENV.development) {
|
||||
console.log(video.videoWidth + "px x " + video.videoHeight + "px");
|
||||
}
|
||||
callback();
|
||||
} else {
|
||||
window.setTimeout(checkVideo, 500);
|
||||
|
||||
@@ -20,12 +20,14 @@ FrameGrabber.create = function(inputStream, canvas) {
|
||||
_canvas.height = _canvasSize.y;
|
||||
_ctx = _canvas.getContext("2d");
|
||||
_data = new Uint8Array(_size.x * _size.y);
|
||||
console.log("FrameGrabber", JSON.stringify({
|
||||
size: _size,
|
||||
topRight: topRight,
|
||||
videoSize: _video_size,
|
||||
canvasSize: _canvasSize
|
||||
}));
|
||||
if (ENV.development) {
|
||||
console.log("FrameGrabber", JSON.stringify({
|
||||
size: _size,
|
||||
topRight: topRight,
|
||||
videoSize: _video_size,
|
||||
canvasSize: _canvasSize
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the given array as frame-buffer
|
||||
|
||||
@@ -34,7 +34,9 @@ ImageLoader.load = function(directory, callback, offset, size, sequence) {
|
||||
}
|
||||
}
|
||||
if (notloadedImgs.length === 0) {
|
||||
console.log("Images loaded");
|
||||
if (ENV.development) {
|
||||
console.log("Images loaded");
|
||||
}
|
||||
callback.apply(null, [htmlImagesArray]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -570,7 +570,9 @@ export default {
|
||||
};
|
||||
|
||||
patchSize = CVUtils.calculatePatchSize(config.patchSize, size);
|
||||
console.log("Patch-Size: " + JSON.stringify(patchSize));
|
||||
if (ENV.development) {
|
||||
console.log("Patch-Size: " + JSON.stringify(patchSize));
|
||||
}
|
||||
|
||||
inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / halfSample) * patchSize.x));
|
||||
inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / halfSample) * patchSize.y));
|
||||
|
||||
+16
-6
@@ -90,7 +90,9 @@ function canRecord(cb) {
|
||||
|
||||
if (_config.numOfWorkers > 0) {
|
||||
initWorkers(function() {
|
||||
console.log("Workers created");
|
||||
if (ENV.development) {
|
||||
console.log("Workers created");
|
||||
}
|
||||
ready(cb);
|
||||
});
|
||||
} else {
|
||||
@@ -148,7 +150,9 @@ function initBuffers(imageWrapper) {
|
||||
});
|
||||
}
|
||||
|
||||
console.log(_inputImageWrapper.size);
|
||||
if (ENV.development) {
|
||||
console.log(_inputImageWrapper.size);
|
||||
}
|
||||
_boxSize = [
|
||||
vec2.clone([0, 0]),
|
||||
vec2.clone([0, _inputImageWrapper.size.y]),
|
||||
@@ -341,14 +345,18 @@ function initWorker(cb) {
|
||||
URL.revokeObjectURL(blobURL);
|
||||
workerThread.busy = false;
|
||||
workerThread.imageData = new Uint8Array(e.data.imageData);
|
||||
console.log("Worker initialized");
|
||||
if (ENV.development) {
|
||||
console.log("Worker initialized");
|
||||
}
|
||||
return cb(workerThread);
|
||||
} else if (e.data.event === 'processed') {
|
||||
workerThread.imageData = new Uint8Array(e.data.imageData);
|
||||
workerThread.busy = false;
|
||||
publishResult(e.data.result, workerThread.imageData);
|
||||
} else if (e.data.event === 'error') {
|
||||
console.log("Worker error: " + e.data.message);
|
||||
if (ENV.development) {
|
||||
console.log("Worker error: " + e.data.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -449,7 +457,9 @@ export default {
|
||||
_stopped = true;
|
||||
_workerPool.forEach(function(workerThread) {
|
||||
workerThread.worker.terminate();
|
||||
console.log("Worker terminated!");
|
||||
if (ENV.development) {
|
||||
console.log("Worker terminated!");
|
||||
}
|
||||
});
|
||||
_workerPool.length = 0;
|
||||
if (_config.inputStream.type === "LiveStream") {
|
||||
@@ -489,7 +499,7 @@ export default {
|
||||
size: 800,
|
||||
src: config.src
|
||||
},
|
||||
numOfWorkers: ENV.development ? 0 : 1,
|
||||
numOfWorkers: (ENV.development && config.debug) ? 0 : 1,
|
||||
locator: {
|
||||
halfSample: false
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ Code39VINReader.prototype._decode = function() {
|
||||
code = code.replace(patterns.IOQ, '');
|
||||
|
||||
if (!code.match(patterns.AZ09)) {
|
||||
console.log('Failed AZ09 pattern code:', code);
|
||||
if (ENV.development) {
|
||||
console.log('Failed AZ09 pattern code:', code);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user