MultiplexHandler.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. /**
  4. * Calls a specific handler function for all events that are encountered.
  5. */
  6. var MultiplexHandler = /** @class */ (function () {
  7. /**
  8. * @param func The function to multiplex all events to.
  9. */
  10. function MultiplexHandler(func) {
  11. this.func = func;
  12. }
  13. MultiplexHandler.prototype.onattribute = function (name, value, quote) {
  14. this.func("onattribute", name, value, quote);
  15. };
  16. MultiplexHandler.prototype.oncdatastart = function () {
  17. this.func("oncdatastart");
  18. };
  19. MultiplexHandler.prototype.oncdataend = function () {
  20. this.func("oncdataend");
  21. };
  22. MultiplexHandler.prototype.ontext = function (text) {
  23. this.func("ontext", text);
  24. };
  25. MultiplexHandler.prototype.onprocessinginstruction = function (name, value) {
  26. this.func("onprocessinginstruction", name, value);
  27. };
  28. MultiplexHandler.prototype.oncomment = function (comment) {
  29. this.func("oncomment", comment);
  30. };
  31. MultiplexHandler.prototype.oncommentend = function () {
  32. this.func("oncommentend");
  33. };
  34. MultiplexHandler.prototype.onclosetag = function (name) {
  35. this.func("onclosetag", name);
  36. };
  37. MultiplexHandler.prototype.onopentag = function (name, attribs) {
  38. this.func("onopentag", name, attribs);
  39. };
  40. MultiplexHandler.prototype.onopentagname = function (name) {
  41. this.func("onopentagname", name);
  42. };
  43. MultiplexHandler.prototype.onerror = function (error) {
  44. this.func("onerror", error);
  45. };
  46. MultiplexHandler.prototype.onend = function () {
  47. this.func("onend");
  48. };
  49. MultiplexHandler.prototype.onparserinit = function (parser) {
  50. this.func("onparserinit", parser);
  51. };
  52. MultiplexHandler.prototype.onreset = function () {
  53. this.func("onreset");
  54. };
  55. return MultiplexHandler;
  56. }());
  57. exports.default = MultiplexHandler;