abstract_postable.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.AbstractPostable = void 0;
  17. var menu_element_js_1 = require("./menu_element.js");
  18. var AbstractPostable = (function (_super) {
  19. __extends(AbstractPostable, _super);
  20. function AbstractPostable() {
  21. var _this = _super !== null && _super.apply(this, arguments) || this;
  22. _this.posted = false;
  23. return _this;
  24. }
  25. AbstractPostable.prototype.isPosted = function () {
  26. return this.posted;
  27. };
  28. AbstractPostable.prototype.post = function (x, y) {
  29. if (this.posted) {
  30. return;
  31. }
  32. if (typeof (x) !== 'undefined' && typeof (y) !== 'undefined') {
  33. this.html.setAttribute('style', 'left: ' + x + 'px; top: ' + y + 'px;');
  34. }
  35. this.display();
  36. this.posted = true;
  37. };
  38. AbstractPostable.prototype.unpost = function () {
  39. if (!this.posted) {
  40. return;
  41. }
  42. var html = this.html;
  43. if (html.parentNode) {
  44. html.parentNode.removeChild(html);
  45. }
  46. this.posted = false;
  47. };
  48. return AbstractPostable;
  49. }(menu_element_js_1.MenuElement));
  50. exports.AbstractPostable = AbstractPostable;
  51. //# sourceMappingURL=abstract_postable.js.map