From 83354b9eeba7926b5bb84957ecd278924bac1621 Mon Sep 17 00:00:00 2001 From: WorldThirteen Date: Sun, 5 Jan 2020 02:31:04 +0200 Subject: [PATCH 1/3] Fix export-related lint rule warning in io files --- lib/io/image.js | 2 +- lib/io/index.js | 4 ++-- lib/io/video.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/io/image.js b/lib/io/image.js index e9a35129..e32db53d 100644 --- a/lib/io/image.js +++ b/lib/io/image.js @@ -8,7 +8,7 @@ import Tensor from '../program/tensor'; -export function imageTensorFromURL(url, type = 'uint8', outShape, cors = false) { +export default function imageTensorFromURL(url, type = 'uint8', outShape, cors = false) { return new Promise((reolve, reject) => { const image = document.createElement('img'); const canvas = document.createElement('canvas'); diff --git a/lib/io/index.js b/lib/io/index.js index cc794805..8f84b2fc 100644 --- a/lib/io/index.js +++ b/lib/io/index.js @@ -8,5 +8,5 @@ export * from './canvas_utils'; export * from './canvas'; -export * from './image'; -export * from './video'; +export { default as imageTensorFromURL } from './image'; +export { default as CaptureVideo } from './video'; diff --git a/lib/io/video.js b/lib/io/video.js index 05435041..3133d022 100755 --- a/lib/io/video.js +++ b/lib/io/video.js @@ -75,7 +75,7 @@ function getMinAvailableSize(r, minWidth, minHeight) { }; } -export class CaptureVideo { +export default class CaptureVideo { static IsAvailable() { const cfg = { video: { From e59c249f7a8527b5655634222bc7af057ffb08c2 Mon Sep 17 00:00:00 2001 From: WorldThirteen Date: Sun, 5 Jan 2020 02:39:05 +0200 Subject: [PATCH 2/3] Fix console lint rule warnings --- lib/program/glsl_error.js | 2 ++ lib/program/kernel_constructor.js | 2 ++ lib/utils.js | 2 ++ test/test_utils.js | 2 ++ 4 files changed, 8 insertions(+) diff --git a/lib/program/glsl_error.js b/lib/program/glsl_error.js index a06935a7..e9b8bf1e 100644 --- a/lib/program/glsl_error.js +++ b/lib/program/glsl_error.js @@ -91,6 +91,7 @@ function injectAll(kernel, error, useStyles = true) { } export default function processError(kernel, kernelName, error) { + /* eslint-disable no-console */ /* due to expected place for console */ try { const prepared = injectAll(kernel, error); const stats = prepared.errorsStats; @@ -104,4 +105,5 @@ export default function processError(kernel, kernelName, error) { } catch (err) { console.warn('Unable to process GLSG compiling error.'); } + /* eslint-enable no-console */ } diff --git a/lib/program/kernel_constructor.js b/lib/program/kernel_constructor.js index a97592f0..a7020cad 100644 --- a/lib/program/kernel_constructor.js +++ b/lib/program/kernel_constructor.js @@ -129,9 +129,11 @@ export default function constructKernel(op) { } if (ENV.DEBUG) { + /* eslint-disable no-console */ /* due to expected place for console */ console.groupCollapsed(op.name); console.log(prepareSourceLines(fullKernel).join('\n')); console.groupEnd(); + /* eslint-enable no-console */ } return fullKernel; diff --git a/lib/utils.js b/lib/utils.js index 0bccd3fb..ee6d6aa3 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -43,7 +43,9 @@ export const isValidOperationShape = shape => shape[0] > 0 && shape[1] > 0; export class DeprecationError extends Error { } export function deprecationWarning(name, msg) { + /* eslint-disable no-console */ /* due to expected place for console */ console.warn(`GammaCV Deprecation Warning: "${name}" is deprecated${msg ? `, ${msg}` : ''}. "${name}" will be removed in next major version.`); + /* eslint-enable no-console */ } export function deprecationError(name, msg) { diff --git a/test/test_utils.js b/test/test_utils.js index 380cca60..5c989351 100644 --- a/test/test_utils.js +++ b/test/test_utils.js @@ -33,7 +33,9 @@ export function logTensorAsTable(tensor, channel = 0) { table.push(raw); } + /* eslint-disable no-console */ /* due to test util */ console.table(table); + /* eslint-enable no-console */ } export function imageDiff(input, output) { From 385e6d0b1a3d08749395f56f27bff60335859dd6 Mon Sep 17 00:00:00 2001 From: WorldThirteen Date: Sun, 5 Jan 2020 02:45:16 +0200 Subject: [PATCH 3/3] Add comment to clear not usual 'if condition' check for safari on video stream size requesting --- lib/io/video.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/io/video.js b/lib/io/video.js index 3133d022..11883899 100755 --- a/lib/io/video.js +++ b/lib/io/video.js @@ -92,6 +92,9 @@ export default class CaptureVideo { const ua = navigator.userAgent; + /* to deal with bug of hard requesting video stream width/height on Safari, + request will be rejected if not actual webcam resolution requested + */ if (ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1) { delete cfg.video.width; delete cfg.video.height;