File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -78,16 +78,25 @@ export class ImageLoader {
78
78
private fileTransfer : FileTransfer ,
79
79
private platform : Platform
80
80
) {
81
- Observable . fromEvent ( document , 'deviceready' ) . first ( ) . subscribe ( res => {
82
- if ( this . nativeAvailable ) {
83
- this . initCache ( ) ;
84
- } else {
81
+ platform . ready ( ) . then ( ( ) => {
82
+ if ( ! platform . is ( 'cordova' ) ) {
85
83
// we are running on a browser, or using livereload
86
84
// plugin will not function in this case
87
85
this . isInit = true ;
88
86
this . throwWarning ( 'You are running on a browser or using livereload, IonicImageLoader will not function, falling back to browser loading.' ) ;
87
+ } else {
88
+ Observable . fromEvent ( document , 'deviceready' ) . first ( ) . subscribe ( res => {
89
+ if ( this . nativeAvailable ) {
90
+ this . initCache ( ) ;
91
+ } else {
92
+ // we are running on a browser, or using livereload
93
+ // plugin will not function in this case
94
+ this . isInit = true ;
95
+ this . throwWarning ( 'You are running on a browser or using livereload, IonicImageLoader will not function, falling back to browser loading.' ) ;
96
+ }
97
+ } )
89
98
}
90
- } )
99
+ } ) ;
91
100
}
92
101
93
102
/**
You can’t perform that action at this time.
0 commit comments