CB-10636 Add JSHint for plugins
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/commit/73118f95 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/tree/73118f95 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/diff/73118f95 Branch: refs/heads/1.0.x Commit: 73118f95e7e1a3bd8fc9ce3475cffea7153593d9 Parents: 7924dd1 Author: daserge <[email protected]> Authored: Tue Feb 23 16:27:01 2016 +0300 Committer: daserge <[email protected]> Committed: Thu Feb 25 13:06:55 2016 +0300 ---------------------------------------------------------------------- .gitignore | 24 ++++++++++++++++++++++++ .jshintrc | 16 ++++++++++++++++ .travis.yml | 4 ++++ README.md | 2 ++ package.json | 9 ++++++++- src/www/ios/ios-wkwebview-exec.js | 16 ++++++---------- 6 files changed, 60 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/73118f95/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2209f42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +#If ignorance is bliss, then somebody knock the smile off my face + +*.csproj.user +*.suo +*.cache +Thumbs.db +*.DS_Store + +*.bak +*.cache +*.log +*.swp +*.user + +node_modules + + + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/73118f95/.jshintrc ---------------------------------------------------------------------- diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..cf48aac --- /dev/null +++ b/.jshintrc @@ -0,0 +1,16 @@ +{ + "browser": true + , "devel": true + , "bitwise": true + , "undef": true + , "trailing": true + , "quotmark": false + , "indent": 4 + , "unused": "vars" + , "latedef": "nofunc" + , "globals": { + "module": false, + "exports": false, + "require": false + } +} http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/73118f95/.travis.yml ---------------------------------------------------------------------- diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b9af4c5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +sudo: false +node_js: + - "4.2" http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/73118f95/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 3655629..360580f 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ # under the License. --> +[](https://travis-ci.org/apache/cordova-plugin-wkwebview-engine) + Cordova WKWebView Engine ====== http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/73118f95/package.json ---------------------------------------------------------------------- diff --git a/package.json b/package.json index 6b052af..d64775f 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,13 @@ "cordova", "wkwebview" ], + "scripts": { + "test": "npm run jshint", + "jshint": "node node_modules/jshint/bin/jshint src" + }, "author": "Apache Cordova", - "license": "Apache-2.0" + "license": "Apache-2.0", + "devDependencies": { + "jshint": "^2.6.0" + } } http://git-wip-us.apache.org/repos/asf/cordova-plugin-wkwebview-engine/blob/73118f95/src/www/ios/ios-wkwebview-exec.js ---------------------------------------------------------------------- diff --git a/src/www/ios/ios-wkwebview-exec.js b/src/www/ios/ios-wkwebview-exec.js index 01b5929..2766acc 100644 --- a/src/www/ios/ios-wkwebview-exec.js +++ b/src/www/ios/ios-wkwebview-exec.js @@ -24,12 +24,8 @@ * commands. */ var cordova = require('cordova'), - channel = require('cordova/channel'), utils = require('cordova/utils'), - base64 = require('cordova/base64'), - commandQueue = [], // Contains pending JS->Native messages. - isInContextOfEvalJs = 0, - failSafeTimerId = 0; + base64 = require('cordova/base64'); function massageArgsJsToNative(args) { if (!args || utils.typeName(args) != 'Array') { @@ -88,7 +84,7 @@ var iOSExec = function() { // bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING; // } - var successCallback, failCallback, service, action, actionArgs, splitCommand; + var successCallback, failCallback, service, action, actionArgs; var callbackId = null; if (typeof arguments[0] !== "string") { // FORMAT ONE @@ -104,8 +100,8 @@ var iOSExec = function() { // an invalid callbackId and passes it even if no callbacks were given. callbackId = 'INVALID'; } else { - throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + - 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);'); + throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' + + 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);'); } // If actionArgs is not provided, default to an empty array @@ -125,7 +121,7 @@ var iOSExec = function() { var command = [callbackId, service, action, JSON.parse(JSON.stringify(actionArgs))]; window.webkit.messageHandlers.cordova.postMessage(command); -} +}; iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) { @@ -155,7 +151,7 @@ function cordovaExec() { function execProxy() { cordovaExec().apply(null, arguments); -}; +} execProxy.nativeFetchMessages = function() { return cordovaExec().nativeFetchMessages.apply(null, arguments); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
