Skip to content

Conversation

@eduardoRoth
Copy link
Member

Detects if you're running with livereload over an emulator or device, if so then ignores cached image (not reachable) and loads from URL.

Copy link
Member

@ihadeed ihadeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Just minor changes.

*/
private getCachedImagePath(url: string): Promise<string> {
// Check if we're running with livereload
let _isDev: boolean = (window['IonicDevServer'] != undefined);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. If the IonicDevServer variable is defined before the app loads, it makes more sense to make this a global variable (either a variable outside the class, or a private property of the class). This way we don't have to evaluate the expression every time getCachedImagePath is called.

}

// if we're running with livereload, ignore cache and call the resource from it's URL
if(!!_isDev){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!! is not required.. since window['IonicDevServer'] != undefined or typeof window['IonicDevServer'] !== 'undefined' will always return a boolean

@eduardoRoth
Copy link
Member Author

Thanks @ihadeed , I've updated the pull following your comments.

@ihadeed ihadeed merged commit ead3918 into zyra:master Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants