1. 1 : import { ABaseMelEvent } from '../../../../mel_metapage/js/lib/html/JsHtml/CustomAttributes/events.js';
  2. 2 :
  3. 3 : /**
  4. 4 : * @callback EventSourceCallback
  5. 5 : * @param {external:moment} start
  6. 6 : * @param {external:moment} end
  7. 7 : * @param {string} timezone
  8. 8 : * @param {function} callback
  9. 9 : */
  10. 10 :
  11. 11 : export class SourceEvent extends ABaseMelEvent {
  12. 12 : #events = [];
  13. 13 : constructor(args) {
  14. 14 : super('fc.loading.source', args.caller);
  15. 15 :
  16. 16 : this.sourceID = args.id;
  17. 17 : this.start = args.start;
  18. 18 : this.end = args.end;
  19. 19 : this.timezone = args.timezone;
  20. 20 : }
  21. 21 :
  22. 22 : addEvent(data) {
  23. 23 : return this.addEvents(data);
  24. 24 : }
  25. 25 :
  26. 26 : addEvents(...events) {
  27. 27 : return this.#events.push(...events);
  28. 28 : }
  29. 29 :
  30. 30 : get events() {
  31. 31 : return this.#events;
  32. 32 : }
  33. 33 : }
  34. 34 : //api:fc.render.event
  35. 35 : //api:fc.render.resource
  36. 36 : export class RenderEvent extends ABaseMelEvent {
  37. 37 : constructor(type, caller, obj, node) {
  38. 38 : super(`fc.render.${type}`, caller);
  39. 39 : this.itemData = obj;
  40. 40 : this.itemNode = node;
  41. 41 : }
  42. 42 : }
  43. 43 :
  44. 44 : export class ViewRender extends ABaseMelEvent {
  45. 45 : #view = null;
  46. 46 : #element = null;
  47. 47 : constructor(view, element, caller) {
  48. 48 : super('view.render', caller);
  49. 49 :
  50. 50 : this.#view = view;
  51. 51 : this.#element = element;
  52. 52 : }
  53. 53 :
  54. 54 : get view() {
  55. 55 : return this.#view;
  56. 56 : }
  57. 57 :
  58. 58 : get viewNode() {
  59. 59 : return this.#element;
  60. 60 : }
  61. 61 :
  62. 62 : get viewTitle() {
  63. 63 : return this.view.title;
  64. 64 : }
  65. 65 :
  66. 66 : get start() {
  67. 67 : return this.view.start;
  68. 68 : }
  69. 69 :
  70. 70 : get end() {
  71. 71 : return this.view.end;
  72. 72 : }
  73. 73 :
  74. 74 : static get EventType() {
  75. 75 : return 'api:view.render';
  76. 76 : }
  77. 77 : }