UNPKG

2.3 kBJavaScriptView Raw
1"use strict";
2var __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})();
15var __assign = (this && this.__assign) || function () {
16 __assign = Object.assign || function(t) {
17 for (var s, i = 1, n = arguments.length; i < n; i++) {
18 s = arguments[i];
19 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20 t[p] = s[p];
21 }
22 return t;
23 };
24 return __assign.apply(this, arguments);
25};
26Object.defineProperty(exports, "__esModule", { value: true });
27var helper_1 = require("../helper");
28var types_1 = require("../types");
29var types_2 = require("./types");
30/**
31 * A set of Actions for Updating, Requesting Features of AppBridge
32 * @public
33 */
34var Features = /** @class */ (function (_super) {
35 __extends(Features, _super);
36 function Features(app, options) {
37 return _super.call(this, app, types_1.Group.Features, types_1.Group.Features, options ? options.id : undefined) || this;
38 }
39 /**
40 * @public
41 */
42 Features.prototype.dispatch = function (action, payload) {
43 switch (action) {
44 case types_2.Action.REQUEST:
45 this.dispatchFeaturesAction(types_2.ActionType.REQUEST, payload);
46 break;
47 }
48 return this;
49 };
50 /**
51 * @internal
52 */
53 Features.prototype.dispatchFeaturesAction = function (type, payload) {
54 this.app.dispatch(helper_1.actionWrapper({
55 group: types_1.Group.Features,
56 type: type,
57 payload: __assign({}, (payload || {}), { id: this.id }),
58 }));
59 };
60 return Features;
61}(helper_1.ActionSet));
62exports.Features = Features;
63/**
64 * @public
65 */
66function create(app, options) {
67 return new Features(app, options);
68}
69exports.create = create;