dialog.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.Dialog = void 0;
  6. var _channelOwner = require("./channelOwner");
  7. var _page = require("./page");
  8. /**
  9. * Copyright (c) Microsoft Corporation.
  10. *
  11. * Licensed under the Apache License, Version 2.0 (the "License");
  12. * you may not use this file except in compliance with the License.
  13. * You may obtain a copy of the License at
  14. *
  15. * http://www.apache.org/licenses/LICENSE-2.0
  16. *
  17. * Unless required by applicable law or agreed to in writing, software
  18. * distributed under the License is distributed on an "AS IS" BASIS,
  19. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. * See the License for the specific language governing permissions and
  21. * limitations under the License.
  22. */
  23. class Dialog extends _channelOwner.ChannelOwner {
  24. static from(dialog) {
  25. return dialog._object;
  26. }
  27. constructor(parent, type, guid, initializer) {
  28. super(parent, type, guid, initializer);
  29. // Note: dialogs that open early during page initialization block it.
  30. // Therefore, we must report the dialog without a page to be able to handle it.
  31. this._page = void 0;
  32. this._page = _page.Page.fromNullable(initializer.page);
  33. }
  34. page() {
  35. return this._page;
  36. }
  37. type() {
  38. return this._initializer.type;
  39. }
  40. message() {
  41. return this._initializer.message;
  42. }
  43. defaultValue() {
  44. return this._initializer.defaultValue;
  45. }
  46. async accept(promptText) {
  47. await this._channel.accept({
  48. promptText
  49. });
  50. }
  51. async dismiss() {
  52. await this._channel.dismiss();
  53. }
  54. }
  55. exports.Dialog = Dialog;