javascript - Enyo onbeforeunload Event -
i'm trying attach listener onbeforeunload in app doesn't seem caught enyo.signals.
according documentation:
within enyo framework itself, dom events have no node targets broadcast signals. these events include window events, onload , onbeforeunload, , events occur directly on document, onkeypress if document has focus. signals useful hooking non-enyo events (e.g., phonegap events) handled enyo kinds in application code.
i wrote following test case:
enyo.kind({ name: "app", kind: "enyo.control", fit: true, content: "hello world", components:[ {kind: "enyo.signals", onbeforeunload: "test"} ], test: function(insender, inevent) { return 'you have unsaved changes!'; } }); this seems have no effect when close tab or navigate away page. missing? here jsfiddle
it doesn't handling beforeunload default:
https://github.com/enyojs/enyo/blob/master/source/dom/dispatcher.js
but, can work like
enyo.dispatcher.listen(window, "beforeunload");
Comments
Post a Comment