Handler.js 2.0 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. Object.defineProperty(exports, "__esModule", { value: true });
  18. exports.AbstractHandler = void 0;
  19. var MathDocument_js_1 = require("./MathDocument.js");
  20. var DefaultMathDocument = (function (_super) {
  21. __extends(DefaultMathDocument, _super);
  22. function DefaultMathDocument() {
  23. return _super !== null && _super.apply(this, arguments) || this;
  24. }
  25. return DefaultMathDocument;
  26. }(MathDocument_js_1.AbstractMathDocument));
  27. var AbstractHandler = (function () {
  28. function AbstractHandler(adaptor, priority) {
  29. if (priority === void 0) { priority = 5; }
  30. this.documentClass = DefaultMathDocument;
  31. this.adaptor = adaptor;
  32. this.priority = priority;
  33. }
  34. Object.defineProperty(AbstractHandler.prototype, "name", {
  35. get: function () {
  36. return this.constructor.NAME;
  37. },
  38. enumerable: false,
  39. configurable: true
  40. });
  41. AbstractHandler.prototype.handlesDocument = function (_document) {
  42. return false;
  43. };
  44. AbstractHandler.prototype.create = function (document, options) {
  45. return new this.documentClass(document, this.adaptor, options);
  46. };
  47. AbstractHandler.NAME = 'generic';
  48. return AbstractHandler;
  49. }());
  50. exports.AbstractHandler = AbstractHandler;
  51. //# sourceMappingURL=Handler.js.map