refactor: use es6 features in index file

This commit is contained in:
Matt Lewis 2016-08-19 08:34:12 +01:00
parent 4e87ac72ea
commit f2bf2b5626

View File

@ -177,87 +177,87 @@ export * from './plugins/plugin';
// Window export to use outside of a module loading system // Window export to use outside of a module loading system
window['IonicNative'] = { window['IonicNative'] = {
ActionSheet: ActionSheet, ActionSheet,
AdMob: AdMob, AdMob,
AndroidFingerprintAuth: AndroidFingerprintAuth, AndroidFingerprintAuth,
AppAvailability: AppAvailability, AppAvailability,
AppRate: AppRate, AppRate,
AppVersion: AppVersion, AppVersion,
Badge: Badge, Badge,
BackgroundGeolocation: BackgroundGeolocation, BackgroundGeolocation,
BackgroundMode: BackgroundMode, BackgroundMode,
BarcodeScanner: BarcodeScanner, BarcodeScanner,
Base64ToGallery: Base64ToGallery, Base64ToGallery,
BatteryStatus: BatteryStatus, BatteryStatus,
Brightness: Brightness, Brightness,
BLE: BLE, BLE,
BluetoothSerial: BluetoothSerial, BluetoothSerial,
Calendar: Calendar, Calendar,
Camera: Camera, Camera,
CameraPreview: CameraPreview, CameraPreview,
CardIO: CardIO, CardIO,
Clipboard: Clipboard, Clipboard,
Contacts: Contacts, Contacts,
Crop: Crop, Crop,
DatePicker: DatePicker, DatePicker,
DBMeter: DBMeter, DBMeter,
Deeplinks: Deeplinks, Deeplinks,
Device: Device, Device,
DeviceAccounts: DeviceAccounts, DeviceAccounts,
DeviceMotion: DeviceMotion, DeviceMotion,
DeviceOrientation: DeviceOrientation, DeviceOrientation,
Dialogs: Dialogs, Dialogs,
Diagnostic: Diagnostic, Diagnostic,
EmailComposer: EmailComposer, EmailComposer,
Facebook: Facebook, Facebook,
File: File, File,
Flashlight: Flashlight, Flashlight,
Geolocation: Geolocation, Geolocation,
Globalization: Globalization, Globalization,
GooglePlus: GooglePlus, GooglePlus,
GoogleMap : GoogleMap, GoogleMap,
GoogleAnalytics: GoogleAnalytics, GoogleAnalytics,
Hotspot: Hotspot, Hotspot,
Httpd: Httpd, Httpd,
IBeacon: IBeacon, IBeacon,
ImagePicker: ImagePicker, ImagePicker,
ImageResizer: ImageResizer, ImageResizer,
InAppBrowser: InAppBrowser, InAppBrowser,
Keyboard: Keyboard, Keyboard,
LaunchNavigator: LaunchNavigator, LaunchNavigator,
LocalNotifications: LocalNotifications, LocalNotifications,
MediaCapture: MediaCapture, MediaCapture,
MediaPlugin: MediaPlugin, MediaPlugin,
NativeAudio: NativeAudio, NativeAudio,
NativeStorage: NativeStorage, NativeStorage,
Network: Network, Network,
Printer: Printer, Printer,
Push: Push, Push,
OneSignal: OneSignal, OneSignal,
PhotoViewer: PhotoViewer, PhotoViewer,
ScreenOrientation: ScreenOrientation, ScreenOrientation,
PinDialog: PinDialog, PinDialog,
SafariViewController: SafariViewController, SafariViewController,
Screenshot: Screenshot, Screenshot,
SecureStorage: SecureStorage, SecureStorage,
Shake: Shake, Shake,
Sim: Sim, Sim,
SMS: SMS, SMS,
SocialSharing: SocialSharing, SocialSharing,
SpinnerDialog: SpinnerDialog, SpinnerDialog,
Splashscreen: Splashscreen, Splashscreen,
SQLite: SQLite, SQLite,
StatusBar: StatusBar, StatusBar,
ThreeDeeTouch: ThreeDeeTouch, ThreeDeeTouch,
Toast: Toast, Toast,
TouchID: TouchID, TouchID,
Transfer: Transfer, Transfer,
TextToSpeech: TextToSpeech, TextToSpeech,
TwitterConnect: TwitterConnect, TwitterConnect,
VideoPlayer: VideoPlayer, VideoPlayer,
Vibration: Vibration, Vibration,
WebIntent: WebIntent, WebIntent,
Zip: Zip Zip
}; };
initAngular1(window['IonicNative']); initAngular1(window['IonicNative']);
@ -266,16 +266,16 @@ initAngular1(window['IonicNative']);
// log an error if it didn't fire in a reasonable amount of time. Generally, // log an error if it didn't fire in a reasonable amount of time. Generally,
// when this happens, developers should remove and reinstall plugins, since // when this happens, developers should remove and reinstall plugins, since
// an inconsistent plugin is often the culprit. // an inconsistent plugin is often the culprit.
let before = +new Date; const before = Date.now();
let didFireReady = false; let didFireReady = false;
document.addEventListener('deviceready', function() { document.addEventListener('deviceready', () => {
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms'); console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms');
didFireReady = true; didFireReady = true;
}); });
setTimeout(function() { setTimeout(() => {
if (!didFireReady && window.cordova) { if (!didFireReady && window.cordova) {
console.warn('Native: deviceready did not fire within ' + DEVICE_READY_TIMEOUT + 'ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.'); console.warn(`Native: deviceready did not fire within ${DEVICE_READY_TIMEOUT}ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.`);
} }
}, DEVICE_READY_TIMEOUT); }, DEVICE_READY_TIMEOUT);