Permalink
Browse files

fixing jshint, added osp and deviceapis as globals to jshintrc file

  • Loading branch information...
1 parent 194c774 commit 1b0fd4a581f755ed8db2291758dfea2e2cab6d67 @filmaj filmaj committed Apr 22, 2012
Showing with 68 additions and 75 deletions.
  1. +1 −1 .jshintrc
  2. +2 −9 lib/bada/plugin/bada/Accelerometer.js
  3. +1 −1 lib/ios/exec.js
  4. +64 −64 lib/wp7/exec.js
View
@@ -28,7 +28,7 @@
"dojo": false,
// Custom predefined globals.
- "predef": ["jasmine", "blackberry", "define", "alert", "prompt", "org"],
+ "predef": ["jasmine", "blackberry", "define", "alert", "prompt", "org", "deviceapis", "Osp"],
// Development
@@ -9,10 +9,8 @@ module.exports = {
};
var error = function(err) {
console.log("Accelermometer:getAcceleration:error");
- switch(err.code) {
- case err.TYPE_MISMATCH_ERR:
- console.log("TYPE MISMATCH ERROR");
- break;
+ if (err.code == err.TYPE_MISMATCH_ERR) {
+ console.log("TYPE MISMATCH ERROR");
}
errorCallback(err);
@@ -28,11 +26,6 @@ module.exports = {
};
var error = function(err) {
console.log("accelerometer:watchAcceleration:error");
- switch(err.code) {
- case err.TYPE_MISMATCH_ERR:
- break;
- }
-
errorCallback(err);
};
return deviceapis.accelerometer.watchAcceleration(success, error);
View
@@ -68,7 +68,7 @@ module.exports = function() {
for (var i = 0; i < actionArgs.length; ++i) {
var arg = actionArgs[i];
if (arg === undefined || arg === null) { // nulls are pushed to the args now (becomes NSNull)
- command.arguments.push(arg);
+ command["arguments"].push(arg);
} else if (typeof(arg) == 'object' && !(arg instanceof Array)) {
command.options = arg;
} else {
View
@@ -2,48 +2,48 @@ var cordova = require('cordova');
/* definition of named properties expected by the native side,
- all arrays are stored in order of how they are received from common js code.
- When other platforms evolve to using named args this will be removed.
+ all arrays are stored in order of how they are received from common js code.
+ When other platforms evolve to using named args this will be removed.
*/
var NamedArgs = {
- File:{
- getFileMetadata:["fullPath"],
- readAsText:["fileName","encoding"],
- readAsDataURL:["fileName"],
- getDirectory:["fullPath","path","options"],
- remove:["fullPath"],
- removeRecursively:["fullPath"],
- getFile:["fullPath","path","options"],
- readEntries:["fullPath"],
- write:["fileName","data","position"],
- truncate:["fileName","size"]
+ File:{
+ getFileMetadata:["fullPath"],
+ readAsText:["fileName","encoding"],
+ readAsDataURL:["fileName"],
+ getDirectory:["fullPath","path","options"],
+ remove:["fullPath"],
+ removeRecursively:["fullPath"],
+ getFile:["fullPath","path","options"],
+ readEntries:["fullPath"],
+ write:["fileName","data","position"],
+ truncate:["fileName","size"]
},
- FileTransfer:{
- upload:["filePath", "server", "fileKey", "fileName", "mimeType", "params", "debug", "chunkedMode"]
- },
- Contacts:{
- search:["fields","options"]
- },
- Media:{
- create:["id","src"],
- startPlayingAudio:["id","src","milliseconds"],
- //stopPlayingAudio
- seekToAudio:["id","milliseconds"],
- //pausePlayingAudio
- //getCurrentPositionAudio
- startRecordingAudio:["id","src"],
- stopRecordingAudio:["id"],
- release:["id"],
- setVolume:["id","volume"]
- },
- Notification: {
- alert:["message","title","buttonLabel"],
- confirm:["message","title","buttonLabel"]
- },
- Camera:{
- takePicture:["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType"]
- }
+ FileTransfer:{
+ upload:["filePath", "server", "fileKey", "fileName", "mimeType", "params", "debug", "chunkedMode"]
+ },
+ Contacts:{
+ search:["fields","options"]
+ },
+ Media:{
+ create:["id","src"],
+ startPlayingAudio:["id","src","milliseconds"],
+ //stopPlayingAudio
+ seekToAudio:["id","milliseconds"],
+ //pausePlayingAudio
+ //getCurrentPositionAudio
+ startRecordingAudio:["id","src"],
+ stopRecordingAudio:["id"],
+ release:["id"],
+ setVolume:["id","volume"]
+ },
+ Notification: {
+ alert:["message","title","buttonLabel"],
+ confirm:["message","title","buttonLabel"]
+ },
+ Camera:{
+ takePicture:["quality", "destinationType", "sourceType", "targetWidth", "targetHeight", "encodingType"]
+ }
};
/**
@@ -72,33 +72,33 @@ module.exports = function(success, fail, service, action, args) {
// generate a new command string, ex. DebugConsole/log/DebugConsole23/{"message":"wtf dude?"}
- if(NamedArgs[service] && NamedArgs[service][action]) {
- var argNames = NamedArgs[service][action];
- var newArgs = {};
- var len = Math.min(args.length,argNames.length);
+ if(NamedArgs[service] && NamedArgs[service][action]) {
+ var argNames = NamedArgs[service][action];
+ var newArgs = {};
+ var len = Math.min(args.length,argNames.length);
- for(var n = 0; n < len; n++) {
- newArgs[argNames[n]] = args[n];
- }
+ for(var n = 0; n < len; n++) {
+ newArgs[argNames[n]] = args[n];
+ }
- args = newArgs;
- }
- else if(args && args.length && args.length == 1) {
- args = args[0];
- }
-
- var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args);
- // pass it on to Notify
- try {
- if(window.external) {
- window.external.Notify(command);
- }
- else {
- console.log("window.external not available :: command=" + command);
- }
- }
- catch(e) {
- console.log("Exception calling native with command :: " + command + " :: exception=" + e);
- }
+ args = newArgs;
+ }
+ else if(args && args.length && args.length == 1) {
+ args = args[0];
+ }
+
+ var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args);
+ // pass it on to Notify
+ try {
+ if(window.external) {
+ window.external.Notify(command);
+ }
+ else {
+ console.log("window.external not available :: command=" + command);
+ }
+ }
+ catch(e) {
+ console.log("Exception calling native with command :: " + command + " :: exception=" + e);
+ }
};

0 comments on commit 1b0fd4a

Please sign in to comment.