Hey @jarvis394 that’s an interesting question, thanks!
We use the o_0 library for observables in the Editor, which offers the observe function to attach a listener. For example when a new project is loaded if you look in the browser console you’ll see the project domain and id logged. This is handled by code like this:
self.projectIsLoaded.observe(function(value) {
if (value) {
self.logger().log(`🙋 ${self.currentProject().domain()}: `, self.currentProject().id());
self.customDomainPreviewHostName('');
if (self.editorIsEmbedded() && self.projectIsMemberOrMoreForCurrentUser()) {
return self.notifyEditInEmbed(true);
}
}
});
where self is the application object. So you could write something like this:
application.projectIsLoaded.observe( function( val ) { if (val) { alert('Project switched!'); } } );