scandit-capacitor-datacapture-core 7.4.0-beta.1 → 7.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ScanditCapacitorDatacaptureCore.podspec +1 -1
- package/android/build.gradle +1 -1
- package/dist/core.js +92 -1
- package/dist/core.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/android/build.gradle
CHANGED
package/dist/core.js
CHANGED
|
@@ -3429,6 +3429,97 @@ function createAdvancedInstanceAwareNativeProxy(nativeCaller, eventsEnum = undef
|
|
|
3429
3429
|
return new AdvancedInstanceAwareNativeProxy(nativeCaller, eventsList);
|
|
3430
3430
|
}
|
|
3431
3431
|
|
|
3432
|
+
/**
|
|
3433
|
+
* JS Proxy hook to act as middleware to all the calls performed by an AdvancedNativeProxy instance
|
|
3434
|
+
* This will allow AdvancedNativeProxy to call dynamically the methods defined in the interface defined
|
|
3435
|
+
* as parameter in createAdvancedNativeProxy function
|
|
3436
|
+
*/
|
|
3437
|
+
const nativeProxyHook = {
|
|
3438
|
+
/**
|
|
3439
|
+
* Dynamic property getter for the AdvancedNativeProxy
|
|
3440
|
+
* In order to call a native method this needs to be preceded by the `$` symbol on the name, ie `$methodName`
|
|
3441
|
+
* In order to set a native event handler this needs to be preceded by `on$` prefix, ie `on$eventName`
|
|
3442
|
+
* @param advancedNativeProxy
|
|
3443
|
+
* @param prop
|
|
3444
|
+
*/
|
|
3445
|
+
get(nativeProxy, prop) {
|
|
3446
|
+
// Important: $ and on$ are required since if they are not added all
|
|
3447
|
+
// properties present on AdvancedNativeProxy will be redirected to the
|
|
3448
|
+
// advancedNativeProxy._call, which will call native even for the own
|
|
3449
|
+
// properties of the class
|
|
3450
|
+
// All the methods with the following structure
|
|
3451
|
+
// $methodName will be redirected to the special _call
|
|
3452
|
+
// method on AdvancedNativeProxy
|
|
3453
|
+
if (prop.startsWith("$")) {
|
|
3454
|
+
if (prop in nativeProxy) {
|
|
3455
|
+
return nativeProxy[prop];
|
|
3456
|
+
}
|
|
3457
|
+
return (args) => {
|
|
3458
|
+
return nativeProxy._call(prop.substring(1), args);
|
|
3459
|
+
};
|
|
3460
|
+
}
|
|
3461
|
+
else {
|
|
3462
|
+
return nativeProxy[prop];
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
};
|
|
3466
|
+
class NativeProxy extends BaseInstanceAwareNativeProxy {
|
|
3467
|
+
constructor(nativeCaller) {
|
|
3468
|
+
super();
|
|
3469
|
+
this.nativeCaller = nativeCaller;
|
|
3470
|
+
this.eventSubscriptions = new Map();
|
|
3471
|
+
this.eventHandlers = new Map();
|
|
3472
|
+
// Create the cached handler once
|
|
3473
|
+
this.cachedEventHandler = (eventName) => (args) => __awaiter(this, void 0, void 0, function* () {
|
|
3474
|
+
this.eventEmitter.emit(eventName, args);
|
|
3475
|
+
});
|
|
3476
|
+
// Wrapping the NativeProxy instance with the JS proxy hook
|
|
3477
|
+
return new Proxy(this, nativeProxyHook);
|
|
3478
|
+
}
|
|
3479
|
+
subscribeForEvents(events) {
|
|
3480
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3481
|
+
for (const event of events) {
|
|
3482
|
+
yield this._registerEvent(event);
|
|
3483
|
+
}
|
|
3484
|
+
});
|
|
3485
|
+
}
|
|
3486
|
+
unsubscribeFromEvents(events) {
|
|
3487
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3488
|
+
for (const event of events) {
|
|
3489
|
+
yield this._unregisterEvent(event);
|
|
3490
|
+
}
|
|
3491
|
+
});
|
|
3492
|
+
}
|
|
3493
|
+
dispose() {
|
|
3494
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3495
|
+
for (const nativeEventName of this.eventSubscriptions.keys()) {
|
|
3496
|
+
yield this._unregisterEvent(nativeEventName);
|
|
3497
|
+
}
|
|
3498
|
+
this.eventSubscriptions.clear();
|
|
3499
|
+
});
|
|
3500
|
+
}
|
|
3501
|
+
_call(fnName, args) {
|
|
3502
|
+
return this.nativeCaller.callFn(fnName, args);
|
|
3503
|
+
}
|
|
3504
|
+
_registerEvent(event) {
|
|
3505
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3506
|
+
const handler = this.cachedEventHandler(event);
|
|
3507
|
+
const subscription = yield this.nativeCaller.registerEvent(event, handler);
|
|
3508
|
+
this.eventSubscriptions.set(event, subscription);
|
|
3509
|
+
});
|
|
3510
|
+
}
|
|
3511
|
+
_unregisterEvent(event) {
|
|
3512
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3513
|
+
const subscription = this.eventSubscriptions.get(event);
|
|
3514
|
+
yield this.nativeCaller.unregisterEvent(event, subscription);
|
|
3515
|
+
this.eventSubscriptions.delete(event);
|
|
3516
|
+
});
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
function createNativeProxy(nativeCaller) {
|
|
3520
|
+
return new NativeProxy(nativeCaller);
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3432
3523
|
class BaseNewController {
|
|
3433
3524
|
get _proxy() {
|
|
3434
3525
|
return this._cachedProxy;
|
|
@@ -3440,5 +3531,5 @@ class BaseNewController {
|
|
|
3440
3531
|
|
|
3441
3532
|
createEventEmitter();
|
|
3442
3533
|
|
|
3443
|
-
export { AdvancedInstanceAwareNativeProxy, AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseInstanceAwareNativeProxy, BaseNativeProxy, BaseNewController, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, createAdvancedInstanceAwareNativeProxy, createAdvancedNativeFromCtorProxy, createAdvancedNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
|
|
3534
|
+
export { AdvancedInstanceAwareNativeProxy, AdvancedNativeProxy, AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, BaseInstanceAwareNativeProxy, BaseNativeProxy, BaseNewController, Brush, Camera, CameraController, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NativeProxy, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, createAdvancedInstanceAwareNativeProxy, createAdvancedNativeFromCtorProxy, createAdvancedNativeProxy, createNativeProxy, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, serializationDefault };
|
|
3444
3535
|
//# sourceMappingURL=core.js.map
|