Factory to use Cordova Toast Plugin on device, and Ionic Popup in browser


#1

Eddy Verbruggen’s Toast plugin is great, but I also want to see them when I’m developing in my browser, so I put together a quick factory that shows Toast on the device, and an Ionic Popup in the browser. It uses the Toast plugin’s API. You can see it here: https://gist.github.com/rajatrocks/4434301a2db198947a60


#2

Nice work. Thanks! By the way, why did you use there a double negation in the code if (!!window.cordova) {... Is this intenionally ? What’s the advantage?


#3

Sure:


#4

Nice! I didn’t know this. This will help me to avoid a lot of issues with NaN, Undefined, etc… cases that happens from time to time and make me throwing away my hairs :slight_smile: Thanks!