html5-qrcode-humifumi-test
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -26,3 +26,3 @@ import { QrcodeErrorCallback, QrcodeSuccessCallback, Html5QrcodeSupportedFormats, Html5QrcodeResult, QrDimensions, QrDimensionFunction } from "./core"; | ||
private readonly qrcode; | ||
private flashOn; | ||
private torchOn; | ||
private shouldScan; | ||
@@ -47,3 +47,5 @@ private element; | ||
getState(): Html5QrcodeScannerState; | ||
switchFlash(): Promise<void>; | ||
getTorchSupported(): boolean; | ||
setTorch(on: boolean): Promise<void>; | ||
switchTorch(): Promise<void>; | ||
stop(): Promise<void>; | ||
@@ -50,0 +52,0 @@ scanFile(imageFile: File, showImage?: boolean): Promise<string>; |
@@ -147,3 +147,3 @@ "use strict"; | ||
this.stateManagerProxy = state_manager_1.StateManagerFactory.create(); | ||
this.flashOn = false; | ||
this.torchOn = false; | ||
} | ||
@@ -266,13 +266,37 @@ Html5QrcodeHumi.prototype.start = function (cameraIdOrConfig, configuration, qrCodeSuccessCallback, qrCodeErrorCallback) { | ||
}; | ||
Html5QrcodeHumi.prototype.switchFlash = function () { | ||
Html5QrcodeHumi.prototype.getTorchSupported = function () { | ||
return this.getRunningTrackCameraCapabilities().torchFeature().isSupported(); | ||
}; | ||
Html5QrcodeHumi.prototype.setTorch = function (on) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
this.flashOn = !this.flashOn; | ||
if (this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) { | ||
this.getRunningTrackCameraCapabilities().torchFeature().apply(this.flashOn); | ||
switch (_a.label) { | ||
case 0: | ||
this.torchOn = on; | ||
if (!this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) return [3, 2]; | ||
return [4, this.getRunningTrackCameraCapabilities().torchFeature().apply(this.torchOn)]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2]; | ||
} | ||
return [2]; | ||
}); | ||
}); | ||
}; | ||
Html5QrcodeHumi.prototype.switchTorch = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
this.torchOn = !this.torchOn; | ||
if (!this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) return [3, 2]; | ||
return [4, this.getRunningTrackCameraCapabilities().torchFeature().apply(this.torchOn)]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Html5QrcodeHumi.prototype.stop = function () { | ||
@@ -279,0 +303,0 @@ var _this = this; |
@@ -26,3 +26,3 @@ import { QrcodeErrorCallback, QrcodeSuccessCallback, Html5QrcodeSupportedFormats, Html5QrcodeResult, QrDimensions, QrDimensionFunction } from "./core"; | ||
private readonly qrcode; | ||
private flashOn; | ||
private torchOn; | ||
private shouldScan; | ||
@@ -47,3 +47,5 @@ private element; | ||
getState(): Html5QrcodeScannerState; | ||
switchFlash(): Promise<void>; | ||
getTorchSupported(): boolean; | ||
setTorch(on: boolean): Promise<void>; | ||
switchTorch(): Promise<void>; | ||
stop(): Promise<void>; | ||
@@ -50,0 +52,0 @@ scanFile(imageFile: File, showImage?: boolean): Promise<string>; |
@@ -96,3 +96,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this.stateManagerProxy = StateManagerFactory.create(); | ||
this.flashOn = false; | ||
this.torchOn = false; | ||
} | ||
@@ -214,10 +214,21 @@ start(cameraIdOrConfig, configuration, qrCodeSuccessCallback, qrCodeErrorCallback) { | ||
} | ||
switchFlash() { | ||
getTorchSupported() { | ||
return this.getRunningTrackCameraCapabilities().torchFeature().isSupported(); | ||
} | ||
setTorch(on) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.flashOn = !this.flashOn; | ||
this.torchOn = on; | ||
if (this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) { | ||
this.getRunningTrackCameraCapabilities().torchFeature().apply(this.flashOn); | ||
yield this.getRunningTrackCameraCapabilities().torchFeature().apply(this.torchOn); | ||
} | ||
}); | ||
} | ||
switchTorch() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.torchOn = !this.torchOn; | ||
if (this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) { | ||
yield this.getRunningTrackCameraCapabilities().torchFeature().apply(this.torchOn); | ||
} | ||
}); | ||
} | ||
stop() { | ||
@@ -224,0 +235,0 @@ if (!this.stateManagerProxy.isScanning()) { |
@@ -26,3 +26,3 @@ import { QrcodeErrorCallback, QrcodeSuccessCallback, Html5QrcodeSupportedFormats, Html5QrcodeResult, QrDimensions, QrDimensionFunction } from "./core"; | ||
private readonly qrcode; | ||
private flashOn; | ||
private torchOn; | ||
private shouldScan; | ||
@@ -47,3 +47,5 @@ private element; | ||
getState(): Html5QrcodeScannerState; | ||
switchFlash(): Promise<void>; | ||
getTorchSupported(): boolean; | ||
setTorch(on: boolean): Promise<void>; | ||
switchTorch(): Promise<void>; | ||
stop(): Promise<void>; | ||
@@ -50,0 +52,0 @@ scanFile(imageFile: File, showImage?: boolean): Promise<string>; |
@@ -144,3 +144,3 @@ var __extends = (this && this.__extends) || (function () { | ||
this.stateManagerProxy = StateManagerFactory.create(); | ||
this.flashOn = false; | ||
this.torchOn = false; | ||
} | ||
@@ -263,13 +263,37 @@ Html5QrcodeHumi.prototype.start = function (cameraIdOrConfig, configuration, qrCodeSuccessCallback, qrCodeErrorCallback) { | ||
}; | ||
Html5QrcodeHumi.prototype.switchFlash = function () { | ||
Html5QrcodeHumi.prototype.getTorchSupported = function () { | ||
return this.getRunningTrackCameraCapabilities().torchFeature().isSupported(); | ||
}; | ||
Html5QrcodeHumi.prototype.setTorch = function (on) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
this.flashOn = !this.flashOn; | ||
if (this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) { | ||
this.getRunningTrackCameraCapabilities().torchFeature().apply(this.flashOn); | ||
switch (_a.label) { | ||
case 0: | ||
this.torchOn = on; | ||
if (!this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) return [3, 2]; | ||
return [4, this.getRunningTrackCameraCapabilities().torchFeature().apply(this.torchOn)]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2]; | ||
} | ||
return [2]; | ||
}); | ||
}); | ||
}; | ||
Html5QrcodeHumi.prototype.switchTorch = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
this.torchOn = !this.torchOn; | ||
if (!this.getRunningTrackCameraCapabilities().torchFeature().isSupported()) return [3, 2]; | ||
return [4, this.getRunningTrackCameraCapabilities().torchFeature().apply(this.torchOn)]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Html5QrcodeHumi.prototype.stop = function () { | ||
@@ -276,0 +300,0 @@ var _this = this; |
@@ -26,3 +26,3 @@ import { QrcodeErrorCallback, QrcodeSuccessCallback, Html5QrcodeSupportedFormats, Html5QrcodeResult, QrDimensions, QrDimensionFunction } from "./core"; | ||
private readonly qrcode; | ||
private flashOn; | ||
private torchOn; | ||
private shouldScan; | ||
@@ -47,3 +47,5 @@ private element; | ||
getState(): Html5QrcodeScannerState; | ||
switchFlash(): Promise<void>; | ||
getTorchSupported(): boolean; | ||
setTorch(on: boolean): Promise<void>; | ||
switchTorch(): Promise<void>; | ||
stop(): Promise<void>; | ||
@@ -50,0 +52,0 @@ scanFile(imageFile: File, showImage?: boolean): Promise<string>; |
{ | ||
"name": "html5-qrcode-humifumi-test", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A cross platform HTML5 QR Code & bar code scanner", | ||
@@ -5,0 +5,0 @@ "main": "./cjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2649840
39539