mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Resolved Issue #1021: The navigatedTo event is called twice for the first application page.
This commit is contained in:
@@ -5,20 +5,18 @@ import tests = require("../testRunner");
|
||||
trace.enable();
|
||||
trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
|
||||
|
||||
let started = false;
|
||||
let page = new Page();
|
||||
page.id = "mainPage";
|
||||
|
||||
page.on(Page.navigatedToEvent, function () {
|
||||
if (!started) {
|
||||
started = true;
|
||||
setTimeout(function () {
|
||||
tests.runAll();
|
||||
}, 10);
|
||||
}
|
||||
});
|
||||
page.on(Page.navigatedToEvent, onNavigatedTo);
|
||||
|
||||
function onNavigatedTo(args) {
|
||||
args.object.off(Page.navigatedToEvent, onNavigatedTo);
|
||||
setTimeout(function () {
|
||||
tests.runAll();
|
||||
}, 10);
|
||||
|
||||
}
|
||||
export function createPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user