mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 16:44:04 +02:00
Listening for page loaded event instead of set timeout === less lag
This commit is contained in:
parent
46679b29f7
commit
46907f446b
1 changed files with 7 additions and 5 deletions
|
@ -1895,16 +1895,18 @@ entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
|||
// Now we want to activate the partice explorer panel!
|
||||
particleExplorerTool.createWebView();
|
||||
var properties = Entities.getEntityProperties(ids[0]);
|
||||
var data = {
|
||||
var particleData = {
|
||||
messageType: "particle_settings",
|
||||
currentProperties: properties
|
||||
};
|
||||
particleExplorerTool.setActiveParticleEntity(ids[0]);
|
||||
Script.setTimeout(function() {
|
||||
// Wait for event bridge on web side to open
|
||||
particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(data));
|
||||
}, 2000)
|
||||
|
||||
particleExplorerTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
||||
var data = JSON.parse(data);
|
||||
if (data.messageType === "page_loaded") {
|
||||
particleExplorerTool.webView.eventBridge.emitScriptEvent(JSON.stringify(particleData));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
particleExplorerTool.destroyWebView();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue