You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/04/22 09:15:30 UTC
[2/2] git commit: fixing jshint,
added osp and deviceapis as globals to jshintrc file
fixing jshint, added osp and deviceapis as globals to jshintrc file
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/1b0fd4a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/1b0fd4a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/1b0fd4a5
Branch: refs/heads/master
Commit: 1b0fd4a581f755ed8db2291758dfea2e2cab6d67
Parents: 194c774
Author: Fil Maj <ma...@gmail.com>
Authored: Sat Apr 21 19:29:28 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Sat Apr 21 19:29:28 2012 -0700
----------------------------------------------------------------------
.jshintrc | 2 +-
lib/bada/plugin/bada/Accelerometer.js | 11 +--
lib/ios/exec.js | 2 +-
lib/wp7/exec.js | 128 ++++++++++++++--------------
4 files changed, 68 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/1b0fd4a5/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
index 551ffc6..2fa61bc 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -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
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/1b0fd4a5/lib/bada/plugin/bada/Accelerometer.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Accelerometer.js b/lib/bada/plugin/bada/Accelerometer.js
index f1c4c87..f3435b0 100644
--- a/lib/bada/plugin/bada/Accelerometer.js
+++ b/lib/bada/plugin/bada/Accelerometer.js
@@ -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);
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/1b0fd4a5/lib/ios/exec.js
----------------------------------------------------------------------
diff --git a/lib/ios/exec.js b/lib/ios/exec.js
index 72a896e..0a3b796 100644
--- a/lib/ios/exec.js
+++ b/lib/ios/exec.js
@@ -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 {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/1b0fd4a5/lib/wp7/exec.js
----------------------------------------------------------------------
diff --git a/lib/wp7/exec.js b/lib/wp7/exec.js
index 6fae6f4..018fce8 100644
--- a/lib/wp7/exec.js
+++ b/lib/wp7/exec.js
@@ -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);
+ }
};