mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
perf(angular): bundle size improvements for angular (#16966)
This commit is contained in:
@@ -3,7 +3,9 @@ import { ActionSheetOptions } from '@ionic/core';
|
||||
|
||||
import { OverlayBaseController } from '../util/overlay';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ActionSheetController extends OverlayBaseController<ActionSheetOptions, HTMLIonActionSheetElement> {
|
||||
constructor() {
|
||||
super('ion-action-sheet-controller');
|
||||
|
||||
@@ -3,7 +3,9 @@ import { AlertOptions } from '@ionic/core';
|
||||
|
||||
import { OverlayBaseController } from '../util/overlay';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AlertController extends OverlayBaseController<AlertOptions, HTMLIonAlertElement> {
|
||||
constructor() {
|
||||
super('ion-alert-controller');
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { Injectable, InjectionToken } from '@angular/core';
|
||||
import { Config as CoreConfig, IonicConfig } from '@ionic/core';
|
||||
|
||||
import { IonicWindow } from '../types/interfaces';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class Config {
|
||||
|
||||
get(key: keyof IonicConfig, fallback?: any): any {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DomController {
|
||||
|
||||
read(cb: RafCallback) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
export type EventHandler = (...args: any[]) => any;
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class Events {
|
||||
private c = new Map<string, EventHandler[]>();
|
||||
|
||||
@@ -72,21 +74,3 @@ export class Events {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function setupEvents() {
|
||||
const events = new Events();
|
||||
|
||||
window.addEventListener('online', ev => events.publish('app:online', ev));
|
||||
|
||||
window.addEventListener('offline', ev => events.publish('app:offline', ev));
|
||||
|
||||
window.addEventListener('orientationchange', ev => events.publish('app:rotated', ev));
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
export function setupProvideEvents() {
|
||||
return () => {
|
||||
return setupEvents();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ export { PopoverController } from './popover-controller';
|
||||
export { ToastController } from './toast-controller';
|
||||
export { NavController } from './nav-controller';
|
||||
export { DomController } from './dom-controller';
|
||||
export { Config, ConfigToken } from './config';
|
||||
export { Config } from './config';
|
||||
|
||||
@@ -3,7 +3,9 @@ import { LoadingOptions } from '@ionic/core';
|
||||
|
||||
import { OverlayBaseController } from '../util/overlay';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class LoadingController extends OverlayBaseController<LoadingOptions, HTMLIonLoadingElement> {
|
||||
constructor() {
|
||||
super('ion-loading-controller');
|
||||
|
||||
@@ -3,7 +3,9 @@ import { Injectable } from '@angular/core';
|
||||
import { proxyMethod } from '../util/util';
|
||||
|
||||
const CTRL = 'ion-menu-controller';
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class MenuController {
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,9 @@ export interface AnimationOptions {
|
||||
|
||||
export interface NavigationOptions extends NavigationExtras, AnimationOptions {}
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class NavController {
|
||||
|
||||
private direction: 'forward' | 'back' | 'root' | 'auto' = DEFAULT_DIRECTION;
|
||||
|
||||
@@ -3,7 +3,9 @@ import { PickerOptions } from '@ionic/core';
|
||||
|
||||
import { OverlayBaseController } from '../util/overlay';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PickerController extends OverlayBaseController<PickerOptions, HTMLIonPickerElement> {
|
||||
constructor() {
|
||||
super('ion-picker-controller');
|
||||
|
||||
@@ -6,7 +6,9 @@ export interface BackButtonEmitter extends Subject<BackButtonEventDetail> {
|
||||
subscribeWithPriority(priority: number, callback: () => Promise<any> | void): Subscription;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class Platform {
|
||||
|
||||
private _readyPromise: Promise<string>;
|
||||
|
||||
@@ -3,7 +3,9 @@ import { ToastOptions } from '@ionic/core';
|
||||
|
||||
import { OverlayBaseController } from '../util/overlay';
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToastController extends OverlayBaseController<ToastOptions, HTMLIonToastElement> {
|
||||
constructor() {
|
||||
super('ion-toast-controller');
|
||||
|
||||
Reference in New Issue
Block a user