dialogDispatcher.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.DialogDispatcher = void 0;
  6. var _dispatcher = require("./dispatcher");
  7. var _pageDispatcher = require("./pageDispatcher");
  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 DialogDispatcher extends _dispatcher.Dispatcher {
  24. constructor(scope, dialog) {
  25. const page = _pageDispatcher.PageDispatcher.fromNullable(scope, dialog.page().initializedOrUndefined());
  26. // Prefer scoping to the page, unless we don't have one.
  27. super(page || scope, dialog, 'Dialog', {
  28. page,
  29. type: dialog.type(),
  30. message: dialog.message(),
  31. defaultValue: dialog.defaultValue()
  32. });
  33. this._type_Dialog = true;
  34. }
  35. async accept(params) {
  36. await this._object.accept(params.promptText);
  37. }
  38. async dismiss() {
  39. await this._object.dismiss();
  40. }
  41. }
  42. exports.DialogDispatcher = DialogDispatcher;