cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Soref <jso...@blackberry.com>
Subject Re: Getting " 'type' of undefined " in LogCat
Date Fri, 20 Jun 2014 16:39:11 GMT
‎Ray wrote:‎
> In general, support questions should be posted to Stack Overflow, or the Google group.
> This list is for the *development* of Cordova itself.

> That being said, you probably forgot to add the plugin.
 ‎
Ray is probably right, but I'll add two other notes:

> <script type="text/javascript" charset="utf-8" src="../../js/cordova-2.2.0.js"></script>

The current version of Cordova is 3.5...

> function checkConnection() {
> var networkState = navigator.connection.type;
> var states = {};
> states[Connection.UNKNOWN] = 'Unknown connection';
...
> states[Connection.NONE] = 'No network connection';

You really shouldn't build an object like this for one time use. Either create the object
once somewhere, or use a switch statement.

> alert('Connection type: ' + states[networkState]);
> }

Mime
View raw message