UNPKG

ngx-modialog

Version:
57 lines (56 loc) 1.94 kB
/** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ import { Injectable } from '@angular/core'; import { DROP_IN_TYPE } from 'ngx-modialog'; var JSNativeModalRenderer = /** @class */ (function () { function JSNativeModalRenderer() { } /** * @param {?} dialog * @param {?} vcRef * @return {?} */ JSNativeModalRenderer.prototype.render = function (dialog, vcRef) { var /** @type {?} */ result; switch (dialog.context.dialogType) { case DROP_IN_TYPE.alert: window.alert(dialog.context.message); result = true; break; case DROP_IN_TYPE.prompt: result = window.prompt(dialog.context.message, dialog.context.promptDefault); break; case DROP_IN_TYPE.confirm: result = window.confirm(dialog.context.message); break; } dialog.destroy = function () { }; if (result === false) { dialog.dismiss(); } else { dialog.close(result); } // we need to return ComponentRef<ModalOverlay> but a native dialog does'nt have that // so we resolve an empty promise, the user of this renderer should expect that. return /** @type {?} */ ({}); }; return JSNativeModalRenderer; }()); export { JSNativeModalRenderer }; JSNativeModalRenderer.decorators = [ { type: Injectable }, ]; function JSNativeModalRenderer_tsickle_Closure_declarations() { /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */ JSNativeModalRenderer.decorators; /** * @nocollapse * @type {function(): !Array<(null|{type: ?, decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>)})>} */ JSNativeModalRenderer.ctorParameters; } //# sourceMappingURL=js-native-modal-renderer.js.map