1 | "use strict";
|
2 | var __extends = (this && this.__extends) || (function () {
|
3 | var extendStatics = function (d, b) {
|
4 | extendStatics = Object.setPrototypeOf ||
|
5 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
7 | return extendStatics(d, b);
|
8 | };
|
9 | return function (d, b) {
|
10 | extendStatics(d, b);
|
11 | function __() { this.constructor = d; }
|
12 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
13 | };
|
14 | })();
|
15 | Object.defineProperty(exports, "__esModule", { value: true });
|
16 | var helper_1 = require("../helper");
|
17 | var types_1 = require("../types");
|
18 | var types_2 = require("./types");
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var Scanner = (function (_super) {
|
24 | __extends(Scanner, _super);
|
25 | function Scanner(app, options) {
|
26 | return _super.call(this, app, types_1.Group.Scanner, types_1.Group.Scanner, options ? options.id : undefined) || this;
|
27 | }
|
28 | |
29 |
|
30 |
|
31 | Scanner.prototype.dispatch = function (action) {
|
32 | switch (action) {
|
33 | case types_2.Action.OPEN_CAMERA:
|
34 | this.dispatchScannerAction(types_2.ActionType.OPEN_CAMERA);
|
35 | break;
|
36 | case types_2.Action.OPEN_NFC:
|
37 | this.dispatchScannerAction(types_2.ActionType.OPEN_NFC);
|
38 | break;
|
39 | }
|
40 | return this;
|
41 | };
|
42 | |
43 |
|
44 |
|
45 | Scanner.prototype.dispatchScannerAction = function (type) {
|
46 | this.app.dispatch(helper_1.actionWrapper({
|
47 | type: type,
|
48 | group: types_1.Group.Scanner,
|
49 | payload: {
|
50 | id: this.id,
|
51 | },
|
52 | }));
|
53 | };
|
54 | return Scanner;
|
55 | }(helper_1.ActionSet));
|
56 | exports.Scanner = Scanner;
|
57 |
|
58 |
|
59 |
|
60 | function create(app, options) {
|
61 | return new Scanner(app, options);
|
62 | }
|
63 | exports.create = create;
|