Widget lifecycle is a little more complicated because a widget is a web page and there are two separate events: loading of the HTML page, and loading of the framework.
Widgets should (normally) have an
For example, the following code is not safe and won't work:
// Create an instance of the framework
var Framework = new FXB.Framework();
// OnLoad handler
Framework.OnLoad = function() { … Called asynchronously. Framework is now ready };
// **WON'T WORK**. This is executed immediately, before the framework has
// had a chance to set itself up, and before it has done a callback into OnLoad().
Framework.Ask(…);
If the user has added your widget into the MyTrader page container, then the widget runs until the user switches to another page. You can't "close" your widget in this context (which would leave a blank space in the page).
If the user has loaded your widget as a dialog or floating panel, then you can choose to close the window. The framework's