canvas-editor-engine 1.0.58 → 1.0.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,14 +8,9 @@ export declare class EventAtom implements ControlEvent {
8
8
  name: string;
9
9
  action: (args?: any) => any;
10
10
  }
11
- export declare abstract class AbstractEventService {
12
- abstract applyEvents(baseElement: HTMLDivElement): void;
13
- }
14
- export default class EventService implements AbstractEventService {
15
- private baseElement;
11
+ export default class EventService {
16
12
  static eventList: EventAtom[];
17
- constructor(baseElement: HTMLDivElement);
18
13
  static subcribe(controlEvent: ControlEvent): void;
19
14
  static dispatch(name: ControlEvent['name'], eventArgs?: any): void;
20
- applyEvents(): void;
15
+ static applyEvents(baseElement: HTMLDivElement): void;
21
16
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AbstractEventService = exports.EventAtom = exports.ControlEvent = void 0;
3
+ exports.EventAtom = exports.ControlEvent = void 0;
4
4
  const guid4_1 = require("../utils/guid4");
5
5
  class ControlEvent {
6
6
  name;
@@ -13,15 +13,8 @@ class EventAtom {
13
13
  action;
14
14
  }
15
15
  exports.EventAtom = EventAtom;
16
- class AbstractEventService {
17
- }
18
- exports.AbstractEventService = AbstractEventService;
19
16
  class EventService {
20
- baseElement;
21
17
  static eventList;
22
- constructor(baseElement) {
23
- this.baseElement = baseElement;
24
- }
25
18
  static subcribe(controlEvent) {
26
19
  const eventAtom = {
27
20
  id: new guid4_1.Guid4().finite,
@@ -33,9 +26,9 @@ class EventService {
33
26
  const eventAtom = EventService.eventList.find((event) => event.name === name);
34
27
  eventAtom.action(eventArgs);
35
28
  }
36
- applyEvents() {
29
+ static applyEvents(baseElement) {
37
30
  EventService.eventList.forEach((event) => {
38
- this.baseElement.addEventListener(event.name, event.action);
31
+ baseElement.addEventListener(event.name, event.action);
39
32
  });
40
33
  }
41
34
  }
@@ -94,8 +94,7 @@ class WebComponent extends HTMLElement {
94
94
  // webComponentWrapper.editorWrap.add(loadingTemplate, loadingStyle);
95
95
  shadowRoot.appendChild(webComponentWrapper.baseElement);
96
96
  canvas_component_1.default.simulateSubscriptions();
97
- const eventService = new event_service_1.default(webComponentWrapper.baseElement);
98
- eventService.applyEvents();
97
+ event_service_1.default.applyEvents(webComponentWrapper.baseElement);
99
98
  this.addEventListener('initial', () => {
100
99
  this.dispatchEvent(new CustomEvent('get-editor-element', {
101
100
  detail: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",