Endless script execution

Dec 5, 2015 at 5:03 PM
Edited Dec 5, 2015 at 6:19 PM
Hello!
Is there any way to make endless script execution?
I have script where I set up event handler for browser that should load page but script ends earlier. Is there any way to force script wait, but not exit?
. . .
var connection = browser.Awesomium.LoadingFrameComplete.connect(function(s, a) {
    Logger.Print('Called successfully!');
});

browser.Awesomium.Source = new Uri('https://google.com'); // connection callback should be fired when this operation will be completed.
After this preparations script execution ends and callback will be never called.

Thanks in advance!
Coordinator
Dec 6, 2015 at 8:57 PM
Hi aki4,

There's no reason to keep the script engine active. In fact, depending on your threading architecture, doing so could create a deadlock between it and the event source. Instead, simply keep the script engine alive as long as it's connected to the event source; that is, don't dispose it until after it disconnects.

Good luck!