Imagine a page registers a hotkey (using the great mousetrap.js) in its init() handler. It will of course unbind that key in the unload() handler.
So now imagine we have 2 pages, both registering for the same hotkey "f5".
WinJS.UI.Pages.define("page1.hml", {
init: function() {
Mousetrap.bind("f5", function() {});
}
unload: function() {
Mousetrap.unbind("f5");
}
}
WinJS.UI.Pages.define("page2.hml", {
init: function() {
Mousetrap.bind("f5", function() {});
}
unload: function() {
Mousetrap.unbind("f5");
}
}
When page2 is active, no hotkey "f5" is registered anymore. Thats due to the way navigator.js calls the unload method of "page1" after everything happened for "page2".The "f5" key registered
by "page2" is unbound by page1's unload handler.