{"size": 3439, "ext": "js", "max_stars_repo_path": "gallery-app/node_modules/@capacitor/core/dist/esm/web/modals.js", "max_stars_repo_name": "shahilpravind/traseable-demo", "max_stars_repo_stars_event_min_datetime": "2020-01-12T23:57:22.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-30T16:35:17.000Z", "max_issues_repo_path": "gallery-app/node_modules/@capacitor/core/dist/esm/web/modals.js", "max_issues_repo_name": "shahilpravind/traseable-demo", "max_issues_repo_issues_event_min_datetime": "2020-01-13T00:45:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-20T04:10:05.000Z", "max_forks_repo_path": "gallery-app/node_modules/@capacitor/core/dist/esm/web/modals.js", "max_forks_repo_name": "shahilpravind/traseable-demo", "max_forks_repo_forks_event_min_datetime": "2020-01-21T21:12:03.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-24T01:15:50.000Z"}
{"max_stars_count": 19, "max_issues_count": 59, "max_forks_count": 7, "avg_line_length": 43.5316455696, "max_line_length": 140, "alphanum_fraction": 0.4571096249}
import { __awaiter, __extends, __generator } from "tslib";
import { WebPlugin } from './index';
var ModalsPluginWeb = /** @class */ (function (_super) {
    __extends(ModalsPluginWeb, _super);
    function ModalsPluginWeb() {
        return _super.call(this, {
            name: 'Modals',
            platforms: ['web']
        }) || this;
    }
    ModalsPluginWeb.prototype.alert = function (options) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                window.alert(options.message);
                return [2 /*return*/, Promise.resolve()];
            });
        });
    };
    ModalsPluginWeb.prototype.prompt = function (options) {
        return __awaiter(this, void 0, void 0, function () {
            var val;
            return __generator(this, function (_a) {
                val = window.prompt(options.message, options.inputText || '');
                return [2 /*return*/, Promise.resolve({
                        value: val,
                        cancelled: val === null
                    })];
            });
        });
    };
    ModalsPluginWeb.prototype.confirm = function (options) {
        return __awaiter(this, void 0, void 0, function () {
            var val;
            return __generator(this, function (_a) {
                val = window.confirm(options.message);
                return [2 /*return*/, Promise.resolve({
                        value: val
                    })];
            });
        });
    };
    ModalsPluginWeb.prototype.showActions = function (options) {
        return __awaiter(this, void 0, void 0, function () {
            var _this = this;
            return __generator(this, function (_a) {
                return [2 /*return*/, new Promise(function (resolve, _reject) { return __awaiter(_this, void 0, void 0, function () {
                        var actionSheet;
                        var _this = this;
                        return __generator(this, function (_a) {
                            actionSheet = document.querySelector('pwa-action-sheet');
                            if (!actionSheet) {
                                actionSheet = document.createElement('pwa-action-sheet');
                                document.body.appendChild(actionSheet);
                            }
                            actionSheet.header = options.title;
                            actionSheet.cancelable = false;
                            actionSheet.options = options.options;
                            actionSheet.addEventListener('onSelection', function (e) { return __awaiter(_this, void 0, void 0, function () {
                                var selection;
                                return __generator(this, function (_a) {
                                    selection = e.detail;
                                    resolve({
                                        index: selection
                                    });
                                    return [2 /*return*/];
                                });
                            }); });
                            return [2 /*return*/];
                        });
                    }); })];
            });
        });
    };
    return ModalsPluginWeb;
}(WebPlugin));
export { ModalsPluginWeb };
var Modals = new ModalsPluginWeb();
export { Modals };
//# sourceMappingURL=modals.js.map