mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
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.
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import { ElementRef, Renderer } from '@angular/core';
|
||||
|
||||
import { Config } from '../config/config';
|
||||
import { getDimensions, clearDimensions } from '../util/dom';
|
||||
|
||||
/**
|
||||
* Base class for all Ionic components. Exposes some common functionality
|
||||
@ -9,8 +8,6 @@ import { getDimensions, clearDimensions } from '../util/dom';
|
||||
* sending/receiving app-level events.
|
||||
*/
|
||||
export class Ion {
|
||||
private _ionId: string;
|
||||
|
||||
/** @private */
|
||||
_config: Config;
|
||||
|
||||
@ -102,34 +99,4 @@ export class Ion {
|
||||
return this._elementRef.nativeElement;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
getDimensions(): { width: number, height: number, left: number, top: number } {
|
||||
return getDimensions(this.getNativeElement(), this._getId());
|
||||
}
|
||||
|
||||
/** @private */
|
||||
width(): number {
|
||||
return getDimensions(this.getNativeElement(), this._getId()).width;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
height(): number {
|
||||
return getDimensions(this.getNativeElement(), this._getId()).height;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
destroy() {
|
||||
clearDimensions(this._ionId);
|
||||
}
|
||||
|
||||
/** internal */
|
||||
_getId() {
|
||||
if (!this._ionId) {
|
||||
this._ionId = 'i' + ids++;
|
||||
}
|
||||
return this._ionId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let ids: number = 0;
|
||||
|
Reference in New Issue
Block a user