Files
Adam Bradley 7000b1b173 refactor: improve tree shaking abilities
Internal refactor completed in order to improve tree shaking and dead
code removal. The public API, with an exception to ion-slides, has
stayed the same. However, internally many changes were required so
bundlers could better exclude modules which should not be bundled.
Ultimately most changes resorted to removing references to `window` or
`document`, or a module that referenced one of those.

BREAKING CHANGES

ion-slides was refactored to remove the external dependencies, and
rewritten in TypeScript/ES6 modules to again improve tree shaking
abilities.
2017-01-09 09:51:39 -06:00

76 lines
1.3 KiB
TypeScript

import { Component, NgModule } from '@angular/core';
import { IonicApp, IonicModule, NavController, Platform } from '../../../..';
@Component({
templateUrl: 'main.html'
})
export class E2EPage {
items: any[] = [];
webview: string = '';
constructor(plt: Platform, public navCtrl: NavController) {
for (var i = 0; i < 200; i++) {
this.items.push({
value: i,
someMethod: function() {
return '!!';
}
});
}
if (plt.is('ios')) {
if (plt.testUserAgent('Safari')) {
this.webview = ': iOS Safari';
} else if (!!window['webkit']) {
this.webview = ': iOS WKWebView';
} else {
this.webview = ': iOS UIWebView';
}
}
}
headerFn(record: any, index: number, records: any[]) {
if (index % 4 === 0) {
return index + ' is divisible by 4';
}
return null;
}
pushPage() {
this.navCtrl.push(E2EPage);
}
reload() {
window.location.reload(true);
}
}
@Component({
template: '<ion-nav [root]="root"></ion-nav>'
})
export class E2EApp {
root = E2EPage;
}
@NgModule({
declarations: [
E2EApp,
E2EPage
],
imports: [
IonicModule.forRoot(E2EApp)
],
bootstrap: [IonicApp],
entryComponents: [
E2EApp,
E2EPage
]
})
export class AppModule {}