diff --git a/ionic/components/nav/test/memory/index.ts b/ionic/components/nav/test/memory/index.ts new file mode 100644 index 0000000000..4726f0b3db --- /dev/null +++ b/ionic/components/nav/test/memory/index.ts @@ -0,0 +1,86 @@ +import {App, Page, NavController} from '../../../../../ionic/ionic'; + + +let delay = 100; +let animate = false; +let count = 0; + +@Page({ + template: ` + +

Page 1

+ + +
+ ` +}) +class Page1 { + tmr; + + constructor(private nav: NavController) {} + + play() { + this.tmr = setTimeout(() => { + count++; + console.log('push', count); + + this.nav.push(Page2, null, { + animate: animate + }); + }, delay); + } + + onPageDidEnter() { + this.play(); + } + + stop() { + clearTimeout(this.tmr); + } +} + +@Page({ + template: ` + +

Page 2

+ + +
+ ` +}) +class Page2 { + tmr; + + constructor(private nav: NavController) {} + + play() { + this.tmr = setTimeout(() => { + count++; + console.log('pop', count); + + this.nav.pop({ + animate: animate + }); + }, delay); + } + + onPageDidEnter() { + this.play(); + } + + stop() { + clearTimeout(this.tmr); + } +} + + +@App({ + template: `` +}) +class E2EApp { + root; + + constructor() { + this.root = Page1; + } +}