Remove console-messages for production build

pull/91/head
Christoph Oberhofer 10 years ago
parent 835f524b33
commit 47f0169709

@ -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 minified version is altered after compression and does not align with the map
file any more. 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> ## <a name="api">API</a>
You can check out the [examples][github_examples] to get an idea of how to 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> ## <a name="changelog">Changelog</a>
### 2016-02-18
- Internal Changes
- Restructuring into meaningful folders
- Removing debug-code in production build
### 2016-02-15 ### 2016-02-15
Take a look at the release-notes ([0.9.0] Take a look at the release-notes ([0.9.0]
(https://github.com/serratus/quaggaJS/releases/tag/v0.9.0)) (https://github.com/serratus/quaggaJS/releases/tag/v0.9.0))

@ -82,13 +82,17 @@ export default {
} else if (typeof readerConfig === 'string') { } else if (typeof readerConfig === 'string') {
reader = readerConfig; reader = readerConfig;
} }
if (ENV.development) {
console.log("Before registering reader: ", reader); console.log("Before registering reader: ", reader);
}
_barcodeReaders.push(new READERS[reader](configuration)); _barcodeReaders.push(new READERS[reader](configuration));
}); });
if (ENV.development) {
console.log("Registered Readers: " + _barcodeReaders console.log("Registered Readers: " + _barcodeReaders
.map((reader) => JSON.stringify({format: reader.FORMAT, config: reader.config})) .map((reader) => JSON.stringify({format: reader.FORMAT, config: reader.config}))
.join(', ')); .join(', '));
} }
}
function initConfig() { function initConfig() {
if (ENV.development && typeof document !== 'undefined') { if (ENV.development && typeof document !== 'undefined') {

@ -27,7 +27,9 @@ function loadedData(video, callback) {
function checkVideo() { function checkVideo() {
if (attempts > 0) { if (attempts > 0) {
if (video.videoWidth > 0 && video.videoHeight > 0) { if (video.videoWidth > 0 && video.videoHeight > 0) {
if (ENV.development) {
console.log(video.videoWidth + "px x " + video.videoHeight + "px"); console.log(video.videoWidth + "px x " + video.videoHeight + "px");
}
callback(); callback();
} else { } else {
window.setTimeout(checkVideo, 500); window.setTimeout(checkVideo, 500);

@ -20,12 +20,14 @@ FrameGrabber.create = function(inputStream, canvas) {
_canvas.height = _canvasSize.y; _canvas.height = _canvasSize.y;
_ctx = _canvas.getContext("2d"); _ctx = _canvas.getContext("2d");
_data = new Uint8Array(_size.x * _size.y); _data = new Uint8Array(_size.x * _size.y);
if (ENV.development) {
console.log("FrameGrabber", JSON.stringify({ console.log("FrameGrabber", JSON.stringify({
size: _size, size: _size,
topRight: topRight, topRight: topRight,
videoSize: _video_size, videoSize: _video_size,
canvasSize: _canvasSize canvasSize: _canvasSize
})); }));
}
/** /**
* Uses the given array as frame-buffer * Uses the given array as frame-buffer

@ -34,7 +34,9 @@ ImageLoader.load = function(directory, callback, offset, size, sequence) {
} }
} }
if (notloadedImgs.length === 0) { if (notloadedImgs.length === 0) {
if (ENV.development) {
console.log("Images loaded"); console.log("Images loaded");
}
callback.apply(null, [htmlImagesArray]); callback.apply(null, [htmlImagesArray]);
} }
}; };

@ -570,7 +570,9 @@ export default {
}; };
patchSize = CVUtils.calculatePatchSize(config.patchSize, size); patchSize = CVUtils.calculatePatchSize(config.patchSize, size);
if (ENV.development) {
console.log("Patch-Size: " + JSON.stringify(patchSize)); console.log("Patch-Size: " + JSON.stringify(patchSize));
}
inputStream.setWidth(Math.floor(Math.floor(size.x / patchSize.x) * (1 / halfSample) * patchSize.x)); 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)); inputStream.setHeight(Math.floor(Math.floor(size.y / patchSize.y) * (1 / halfSample) * patchSize.y));

@ -90,7 +90,9 @@ function canRecord(cb) {
if (_config.numOfWorkers > 0) { if (_config.numOfWorkers > 0) {
initWorkers(function() { initWorkers(function() {
if (ENV.development) {
console.log("Workers created"); console.log("Workers created");
}
ready(cb); ready(cb);
}); });
} else { } else {
@ -148,7 +150,9 @@ function initBuffers(imageWrapper) {
}); });
} }
if (ENV.development) {
console.log(_inputImageWrapper.size); console.log(_inputImageWrapper.size);
}
_boxSize = [ _boxSize = [
vec2.clone([0, 0]), vec2.clone([0, 0]),
vec2.clone([0, _inputImageWrapper.size.y]), vec2.clone([0, _inputImageWrapper.size.y]),
@ -341,15 +345,19 @@ function initWorker(cb) {
URL.revokeObjectURL(blobURL); URL.revokeObjectURL(blobURL);
workerThread.busy = false; workerThread.busy = false;
workerThread.imageData = new Uint8Array(e.data.imageData); workerThread.imageData = new Uint8Array(e.data.imageData);
if (ENV.development) {
console.log("Worker initialized"); console.log("Worker initialized");
}
return cb(workerThread); return cb(workerThread);
} else if (e.data.event === 'processed') { } else if (e.data.event === 'processed') {
workerThread.imageData = new Uint8Array(e.data.imageData); workerThread.imageData = new Uint8Array(e.data.imageData);
workerThread.busy = false; workerThread.busy = false;
publishResult(e.data.result, workerThread.imageData); publishResult(e.data.result, workerThread.imageData);
} else if (e.data.event === 'error') { } else if (e.data.event === 'error') {
if (ENV.development) {
console.log("Worker error: " + e.data.message); console.log("Worker error: " + e.data.message);
} }
}
}; };
workerThread.worker.postMessage({ workerThread.worker.postMessage({
@ -449,7 +457,9 @@ export default {
_stopped = true; _stopped = true;
_workerPool.forEach(function(workerThread) { _workerPool.forEach(function(workerThread) {
workerThread.worker.terminate(); workerThread.worker.terminate();
if (ENV.development) {
console.log("Worker terminated!"); console.log("Worker terminated!");
}
}); });
_workerPool.length = 0; _workerPool.length = 0;
if (_config.inputStream.type === "LiveStream") { if (_config.inputStream.type === "LiveStream") {
@ -489,7 +499,7 @@ export default {
size: 800, size: 800,
src: config.src src: config.src
}, },
numOfWorkers: ENV.development ? 0 : 1, numOfWorkers: (ENV.development && config.debug) ? 0 : 1,
locator: { locator: {
halfSample: false halfSample: false
} }

@ -29,7 +29,9 @@ Code39VINReader.prototype._decode = function() {
code = code.replace(patterns.IOQ, ''); code = code.replace(patterns.IOQ, '');
if (!code.match(patterns.AZ09)) { if (!code.match(patterns.AZ09)) {
if (ENV.development) {
console.log('Failed AZ09 pattern code:', code); console.log('Failed AZ09 pattern code:', code);
}
return null; return null;
} }

Loading…
Cancel
Save