item_command.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. extendStatics(d, b);
  11. function __() { this.constructor = d; }
  12. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13. };
  14. })();
  15. Object.defineProperty(exports, "__esModule", { value: true });
  16. exports.Command = void 0;
  17. var abstract_item_js_1 = require("./abstract_item.js");
  18. var menu_util_js_1 = require("./menu_util.js");
  19. var Command = (function (_super) {
  20. __extends(Command, _super);
  21. function Command(menu, content, command, id) {
  22. var _this = _super.call(this, menu, 'command', content, id) || this;
  23. _this.command = command;
  24. return _this;
  25. }
  26. Command.fromJson = function (_factory, _a, menu) {
  27. var content = _a.content, action = _a.action, id = _a.id;
  28. return new this(menu, content, action, id);
  29. };
  30. Command.prototype.executeAction = function () {
  31. try {
  32. this.command(menu_util_js_1.MenuUtil.getActiveElement(this));
  33. }
  34. catch (e) {
  35. menu_util_js_1.MenuUtil.error(e, 'Illegal command callback.');
  36. }
  37. menu_util_js_1.MenuUtil.close(this);
  38. };
  39. Command.prototype.toJson = function () {
  40. return { type: ''
  41. };
  42. };
  43. return Command;
  44. }(abstract_item_js_1.AbstractItem));
  45. exports.Command = Command;
  46. //# sourceMappingURL=item_command.js.map