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 {
7878 private fileTransfer : FileTransfer ,
7979 private platform : Platform
8080 ) {
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' ) ) {
8583 // we are running on a browser, or using livereload
8684 // plugin will not function in this case
8785 this . isInit = true ;
8886 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+ } )
8998 }
90- } )
99+ } ) ;
91100 }
92101
93102 /**
You can’t perform that action at this time.
0 commit comments