2015-12-02 03:33:08 +08:00
import { initAngular1 } from './ng1' ;
initAngular1 ( ) ;
2015-11-30 06:30:15 +08:00
const DEVICE_READY_TIMEOUT = 2000 ;
2015-12-02 03:33:08 +08:00
declare var window ;
import { ActionSheet } from './plugins/actionsheet' ;
2016-02-02 22:35:45 +08:00
import { BarcodeScanner } from './plugins/barcodescanner' ;
2015-12-02 03:33:08 +08:00
import { BLE } from './plugins/ble' ;
import { Camera } from './plugins/camera' ;
import { Calendar } from './plugins/calendar' ;
2015-12-02 08:47:24 +08:00
import { Contacts } from './plugins/contacts' ;
2015-12-02 03:33:08 +08:00
import { Device } from './plugins/device' ;
import { Facebook } from './plugins/facebook' ;
import { Geolocation } from './plugins/geolocation' ;
2015-12-02 08:47:24 +08:00
import { Push } from './plugins/push' ;
2015-12-02 03:33:08 +08:00
import { StatusBar } from './plugins/statusbar' ;
import { Toast } from './plugins/toast' ;
2015-12-02 09:06:38 +08:00
import { TouchID } from './plugins/touchid' ;
2015-12-02 03:33:08 +08:00
2015-12-02 08:47:24 +08:00
export {
ActionSheet ,
2016-02-02 22:35:45 +08:00
BarcodeScanner ,
2015-12-02 08:47:24 +08:00
BLE ,
Camera ,
Calendar ,
Contacts ,
Device ,
Facebook ,
Geolocation ,
Push ,
StatusBar ,
2015-12-02 09:06:38 +08:00
Toast ,
TouchID
2015-12-02 08:47:24 +08:00
}
2015-12-02 03:33:08 +08:00
// Window export to use outside of a module loading system
window [ 'IonicNative' ] = {
ActionSheet : ActionSheet ,
2016-02-02 22:35:45 +08:00
BarcodeScanner ,
2015-12-02 03:33:08 +08:00
BLE : BLE ,
Camera : Camera ,
Calendar : Calendar ,
2015-12-02 08:47:24 +08:00
Contacts : Contacts ,
2015-12-02 03:33:08 +08:00
Device : Device ,
Facebook : Facebook ,
Geolocation : Geolocation ,
2015-12-02 08:47:24 +08:00
Push : Push ,
2015-12-02 03:33:08 +08:00
StatusBar : StatusBar ,
2015-12-02 09:06:38 +08:00
Toast : Toast ,
TouchID : TouchID
2015-12-02 03:33:08 +08:00
}
2015-11-30 07:20:11 +08:00
// To help developers using cordova, we listen for the device ready event and
// 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.
2015-12-01 03:27:25 +08:00
let before = + new Date ;
2015-11-30 06:30:15 +08:00
let didFireReady = false ;
2015-12-01 03:27:25 +08:00
document . addEventListener ( 'deviceready' , function ( ) {
console . log ( 'DEVICE READY FIRED AFTER' , ( + new Date - before ) , 'ms' )
2015-11-30 06:30:15 +08:00
didFireReady = true ;
} )
setTimeout ( function ( ) {
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.' ) ;
}
} , DEVICE_READY_TIMEOUT ) ;