chore(exports): update core exports

This commit is contained in:
Adam Bradley
2018-05-16 11:39:41 -05:00
parent b70c192fd9
commit f3dc8a0fed
4 changed files with 10 additions and 22 deletions

View File

@ -3,19 +3,20 @@ import { configFromURL } from '../utils/config';
import { isIOS } from '../utils/platform'; import { isIOS } from '../utils/platform';
import { Config } from './config'; import { Config } from './config';
const Ionic = (window as any).Ionic = (window as any).Ionic || {};
const Ionic = (window as any)['Ionic'] = (window as any)['Ionic'] || {};
declare const Context: any; declare const Context: any;
// queue used to coordinate DOM reads and // queue used to coordinate DOM reads and
// write in order to avoid layout thrashing // write in order to avoid layout thrashing
Object.defineProperty(Ionic, 'queue', { Object.defineProperty(Ionic, 'queue', {
get: () => Context.queue get: () => Context['queue']
}); });
// create the Ionic.config from raw config object (if it exists) // create the Ionic.config from raw config object (if it exists)
// and convert Ionic.config into a ConfigApi that has a get() fn // and convert Ionic.config into a ConfigApi that has a get() fn
const config = Ionic.config = Context.config = new Config({ const config = Ionic['config'] = Context['config'] = new Config({
...Ionic.config, ...Ionic['config'],
...configFromURL() ...configFromURL()
}); });

View File

@ -1,3 +1,5 @@
// lifecycle
export const enum ViewLifecycle { export const enum ViewLifecycle {
WillEnter = 'ionViewWillEnter', WillEnter = 'ionViewWillEnter',
DidEnter = 'ionViewDidEnter', DidEnter = 'ionViewDidEnter',
@ -6,10 +8,12 @@ export const enum ViewLifecycle {
WillUnload = 'ionViewWillUnload', WillUnload = 'ionViewWillUnload',
} }
// Util functions // util functions
export * from './utils/helpers'; export * from './utils/helpers';
export * from './utils/haptic'; export * from './utils/haptic';
export * from './utils/framework-delegate'; export * from './utils/framework-delegate';
export * from './utils/platform'; export * from './utils/platform';
export * from './utils/config'; export * from './utils/config';
// interface
export * from './interface';

View File

@ -21,9 +21,6 @@ export * from './components/toast/toast-interface';
export * from './utils/input-interface'; export * from './utils/input-interface';
export * from './global/config'; export * from './global/config';
// export index
export * from './index';
export type Color = 'default'| 'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark'; export type Color = 'default'| 'primary' | 'secondary' | 'tertiary' | 'success' | 'warning' | 'danger' | 'light' | 'medium' | 'dark';
export type Mode = 'ios' | 'md'; export type Mode = 'ios' | 'md';
export type ComponentRef = Function | HTMLElement | string; export type ComponentRef = Function | HTMLElement | string;

View File

@ -1,18 +1,4 @@
export function setupConfig(config: {[key: string]: any}) {
const win = window as any;
const Ionic = win.Ionic;
if (Ionic && Ionic.config && Ionic.config.constructor.name !== 'Object') {
console.error('ionic config was already initialized');
return;
}
win.Ionic = win.Ionic || {};
win.Ionic.config = {
...win.Ionic.config,
...config
};
return win.Ionic.config;
}
export function configFromURL() { export function configFromURL() {
const config: any = {}; const config: any = {};