javascript - SAPUI5: function hook when something is destroyed -
i have sapui5 panel can destroyed indirectly in various circumstances various reasons (e.g. in example, parent of parent destroyed). therefore, must use function hook coming control itself.
i tried call exit function (base on this stack overflow question , this sapui5 documentation)
var ograndparentpanel = new sap.m.panel(); var oparentpanel = new sap.m.panel(); var opanel = new sap.m.panel({ exit: function(){ alert("foobar!"); }}); oparentpanel.addcontent(opanel); ograndparentpanel.addcontent(oparentpanel); ograndparentpanel.destroy();
i want "foobar!" alert, not getting it.
i think confusing lifecycle methods events. lifecycle methods defined within control , control can either implement them or not. events hooks bind own functionality to.
if have panel calls event (that attach own logic to), subclass panel control. define new event in metadata , in onexit
method, fire event.
if interesting in doing when user closes browser, there both window.onbeforeunload
, window.onunload
that use. unfortunately, not 100% browser independent , there not guarantee called @ all.
Comments
Post a Comment