UNPKG

cordova-angular

Version:
56 lines 2.84 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; // cordova-plugin-dialogs import { Injectable, NgZone } from '@angular/core'; import { mergeMap } from "rxjs/operators"; import { Cordova, ZoneObservable } from '../'; var DialogsService = /** @class */ (function () { function DialogsService(zone) { this.zone = zone; } DialogsService.prototype.alert = function (message, title, buttonName) { var _this = this; return Cordova.deviceready.pipe(mergeMap(function () { return ZoneObservable.create(_this.zone, function (observer) { window.navigator.notification.alert(message, function (res) { observer.next(res); observer.complete(); }, title, buttonName); }); })); }; DialogsService.prototype.confirm = function (message, title, buttonLabels) { var _this = this; return Cordova.deviceready.pipe(mergeMap(function () { return ZoneObservable.create(_this.zone, function (observer) { window.navigator.notification.confirm(message, function (res) { observer.next(res); observer.complete(); }, title, buttonLabels); }); })); }; DialogsService.prototype.prompt = function (message, title, buttonLabels, defaultText) { var _this = this; return Cordova.deviceready.pipe(mergeMap(function () { return ZoneObservable.create(_this.zone, function (observer) { window.navigator.notification.prompt(message, function (res) { observer.next(res); observer.complete(); }, title, buttonLabels, defaultText); }); })); }; DialogsService.prototype.beep = function (times) { var _this = this; return Cordova.deviceready.pipe(mergeMap(function () { return ZoneObservable.of(_this.zone, window.navigator.notification.beep(times)); })); }; DialogsService = __decorate([ Injectable(), __metadata("design:paramtypes", [NgZone]) ], DialogsService); return DialogsService; }()); export { DialogsService }; //# sourceMappingURL=dialogs.js.map