Page 1 of 1

How to listen to sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED event ?

Posted: Fri Jul 07, 2023 8:22 am
by Vince
Hello,

I try to customize Web Author listening the event sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED in my-framework.js :

Code: Select all

goog.events.listen(workspace, sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED, (e) => {
    console.info("extension enabled");
});
This code doesn' work.

If I listen to sync.api.Workspace.EventType.EDITOR_LOADED, it works

Code: Select all

goog.events.listen(workspace, sync.api.Workspace.EventType.EDITOR_LOADED, (e) => {
    console.info("extension enabled");
});
Why ?

I follow this guide : https://www.oxygenxml.com/doc/versions/ ... ing-option
I'm using oxygen web author version 25.1.0

Regards,
Vincent

Re: How to listen to sync.api.Workspace.EventType.BEFORE_EDITOR_LOADED event ?

Posted: Fri Jul 07, 2023 9:33 am
by cristi_talau
Hello,
The order of events during editor loading is the following:
  • BEFORE_EDITOR_LOADED is dispatched
  • File content is read from the file server
  • Framework is determined based on the content of the file
  • JavaScript code from the framework is loaded
  • EDITOR_LOADED_EVENT is dispatched
If you want to listen to BEFORE_EDITOR_LOADED you can use a plugin. The code from plugins is loaded when the application starts.

Best,
Cristian