diff --git a/packages/core/src/editor/types.ts b/packages/core/src/editor/types.ts index b39431c37..99960edb8 100644 --- a/packages/core/src/editor/types.ts +++ b/packages/core/src/editor/types.ts @@ -21,6 +21,13 @@ export enum EditorEvents { */ redo = 'redo', + /** + * @event `load` Editor is loaded. At this stage, the project is loaded in the editor and elements in the canvas are rendered. + * @example + * editor.on('load', () => { ... }); + */ + load = 'load', + /** * @event `project:load` Project JSON loaded in the editor. The event is triggered on the initial load and on the `editor.loadProjectData` method. * @example @@ -35,6 +42,13 @@ export enum EditorEvents { */ log = 'log', + /** + * @event `telemetry:init` Initial telemetry data are sent. + * @example + * editor.on('telemetry:init', () => { ... }); + */ + telemetryInit = 'telemetry:init', + /** * @event `destroy` Editor started destroy (on `editor.destroy()`). * @example diff --git a/packages/core/src/editor/view/EditorView.ts b/packages/core/src/editor/view/EditorView.ts index 18d20306b..a45d06327 100644 --- a/packages/core/src/editor/view/EditorView.ts +++ b/packages/core/src/editor/view/EditorView.ts @@ -2,6 +2,7 @@ import { View, $ } from '../../common'; import { getHostName } from '../../utils/host-name'; import { appendStyles } from '../../utils/mixins'; import EditorModel from '../model/Editor'; +import { EditorEvents } from '../types'; export default class EditorView extends View { constructor(model: EditorModel) { @@ -20,7 +21,7 @@ export default class EditorView extends View { } setTimeout(() => { - model.trigger('load', model.Editor); + model.trigger(EditorEvents.load, model.Editor); model.clearDirtyCount(); }); }); @@ -91,6 +92,6 @@ export default class EditorView extends View { } }); - this.trigger('telemetry:sent'); + this.trigger(EditorEvents.telemetryInit); } }