mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00

* chore(tslint): fix tslint config & errors * chore(tslint): enable double quotes, whitespace, and arrow-return-shorthand rules and fix errors
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import { EventData } from "tns-core-modules/data/observable";
|
|
import { Page, NavigatedData } from "tns-core-modules/ui/page";
|
|
import { topmost, NavigationEntry } from "tns-core-modules/ui/frame";
|
|
|
|
export function nav() {
|
|
const e: NavigationEntry = {
|
|
moduleName: "navigation-app/main-page"
|
|
}
|
|
topmost().navigate(e)
|
|
}
|
|
export function navClearTrans() {
|
|
console.log("transition and clear")
|
|
|
|
const e: NavigationEntry = {
|
|
transition: {
|
|
name: "slideLeft",
|
|
curve: "linear"
|
|
},
|
|
clearHistory: true,
|
|
moduleName: "navigation-app/main-page"
|
|
}
|
|
topmost().navigate(e)
|
|
}
|
|
|
|
export function navWithTransition() {
|
|
const e: NavigationEntry = {
|
|
transition: {
|
|
name: "slideLeft",
|
|
curve: "linear"
|
|
},
|
|
moduleName: "navigation-app/main-page"
|
|
}
|
|
topmost().navigate(e)
|
|
}
|
|
|
|
export function navWithClear() {
|
|
const e: NavigationEntry = {
|
|
clearHistory: true,
|
|
moduleName: "navigation-app/main-page"
|
|
}
|
|
topmost().navigate(e)
|
|
}
|
|
|
|
let i = 0;
|
|
const colors = ["lightgreen", "lightblue", "lightcoral"]
|
|
|
|
export function navigatedFrom(args: NavigatedData) {
|
|
console.log(`navigatedFrom ${args.object.toString()} isBack: ${args.isBackNavigation}`)
|
|
}
|
|
|
|
export function navigatedTo(args: NavigatedData) {
|
|
console.log(`navigatedTo ${args.object.toString()} isBack: ${args.isBackNavigation}`)
|
|
}
|
|
|
|
export function navigatingTo(args: NavigatedData) {
|
|
if (!args.isBackNavigation) {
|
|
(<any>args.object).page.backgroundColor = colors[(i++) % 3];
|
|
const array = new Array();
|
|
for (let i = 0; i < 50; i++) {
|
|
array[i] = i;
|
|
}
|
|
(<any>args.object).page.bindingContext = array;
|
|
}
|
|
console.log(`navigatingTo ${args.object.toString()} isBack: ${args.isBackNavigation}`)
|
|
}
|
|
|
|
export function navigatingFrom(args: NavigatedData) {
|
|
console.log(`navigatingFrom ${args.object.toString()} isBack: ${args.isBackNavigation}`)
|
|
}
|