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['IonicNative'] = {
ActionSheet: ActionSheet,
AdMob: AdMob,
AndroidFingerprintAuth: AndroidFingerprintAuth,
AppAvailability: AppAvailability,
AppRate: AppRate,
AppVersion: AppVersion,
Badge: Badge,
BackgroundGeolocation: BackgroundGeolocation,
BackgroundMode: BackgroundMode,
BarcodeScanner: BarcodeScanner,
Base64ToGallery: Base64ToGallery,
BatteryStatus: BatteryStatus,
Brightness: Brightness,
BLE: BLE,
BluetoothSerial: BluetoothSerial,
Calendar: Calendar,
Camera: Camera,
CameraPreview: CameraPreview,
CardIO: CardIO,
Clipboard: Clipboard,
Contacts: Contacts,
Crop: Crop,
DatePicker: DatePicker,
DBMeter: DBMeter,
Deeplinks: Deeplinks,
Device: Device,
DeviceAccounts: DeviceAccounts,
DeviceMotion: DeviceMotion,
DeviceOrientation: DeviceOrientation,
Dialogs: Dialogs,
Diagnostic: Diagnostic,
EmailComposer: EmailComposer,
Facebook: Facebook,
File: File,
Flashlight: Flashlight,
Geolocation: Geolocation,
Globalization: Globalization,
GooglePlus: GooglePlus,
GoogleMap : GoogleMap,
GoogleAnalytics: GoogleAnalytics,
Hotspot: Hotspot,
Httpd: Httpd,
IBeacon: IBeacon,
ImagePicker: ImagePicker,
ImageResizer: ImageResizer,
InAppBrowser: InAppBrowser,
Keyboard: Keyboard,
LaunchNavigator: LaunchNavigator,
LocalNotifications: LocalNotifications,
MediaCapture: MediaCapture,
MediaPlugin: MediaPlugin,
NativeAudio: NativeAudio,
NativeStorage: NativeStorage,
Network: Network,
Printer: Printer,
Push: Push,
OneSignal: OneSignal,
PhotoViewer: PhotoViewer,
ScreenOrientation: ScreenOrientation,
PinDialog: PinDialog,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
SecureStorage: SecureStorage,
Shake: Shake,
Sim: Sim,
SMS: SMS,
SocialSharing: SocialSharing,
SpinnerDialog: SpinnerDialog,
Splashscreen: Splashscreen,
SQLite: SQLite,
StatusBar: StatusBar,
ThreeDeeTouch: ThreeDeeTouch,
Toast: Toast,
TouchID: TouchID,
Transfer: Transfer,
TextToSpeech: TextToSpeech,
TwitterConnect: TwitterConnect,
VideoPlayer: VideoPlayer,
Vibration: Vibration,
WebIntent: WebIntent,
Zip: Zip
ActionSheet,
AdMob,
AndroidFingerprintAuth,
AppAvailability,
AppRate,
AppVersion,
Badge,
BackgroundGeolocation,
BackgroundMode,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
Brightness,
BLE,
BluetoothSerial,
Calendar,
Camera,
CameraPreview,
CardIO,
Clipboard,
Contacts,
Crop,
DatePicker,
DBMeter,
Deeplinks,
Device,
DeviceAccounts,
DeviceMotion,
DeviceOrientation,
Dialogs,
Diagnostic,
EmailComposer,
Facebook,
File,
Flashlight,
Geolocation,
Globalization,
GooglePlus,
GoogleMap,
GoogleAnalytics,
Hotspot,
Httpd,
IBeacon,
ImagePicker,
ImageResizer,
InAppBrowser,
Keyboard,
LaunchNavigator,
LocalNotifications,
MediaCapture,
MediaPlugin,
NativeAudio,
NativeStorage,
Network,
Printer,
Push,
OneSignal,
PhotoViewer,
ScreenOrientation,
PinDialog,
SafariViewController,
Screenshot,
SecureStorage,
Shake,
Sim,
SMS,
SocialSharing,
SpinnerDialog,
Splashscreen,
SQLite,
StatusBar,
ThreeDeeTouch,
Toast,
TouchID,
Transfer,
TextToSpeech,
TwitterConnect,
VideoPlayer,
Vibration,
WebIntent,
Zip
};
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,
// when this happens, developers should remove and reinstall plugins, since
// an inconsistent plugin is often the culprit.
let before = +new Date;
const before = Date.now();
let didFireReady = false;
document.addEventListener('deviceready', function() {
console.log('DEVICE READY FIRED AFTER', (+new Date - before), 'ms');
document.addEventListener('deviceready', () => {
console.log('DEVICE READY FIRED AFTER', (Date.now() - before), 'ms');
didFireReady = true;
});
setTimeout(function() {
setTimeout(() => {
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);