cordovacordova-pluginsvisual-studio-cordovaripple

Cordova is not defined after onDeviceReady


I am trying to build a Cordova app and test it in Ripple. When I start the application the onDeviceReady hook fires and I have cordova variable and all my plugin variables are accessible.

However after the application loads and I try to access cordova from console, e.g., it is undefined.

I am not sure what is going on, but somehow it disappears. Is it supposed to work at all like that with Ripple or I have to test everything only on real device / emulator?

P.S. It happens in a completely new blank project created in VS2015 as well. So I don't really understand how I am supposed to access cordova and plugins if it becomes undefined somehow?


Solution

  • I think I found the answer. The trick is to stay within the realm of the application on the device and load all of the javascript from the remote server. In a SPA application like Angular case, it's only the bootstrap index.html of the application that is required and nothing else. All the .js files can be referenced and the application will "auto-update" itself.