Skip to content
This repository was archived by the owner on Apr 2, 2018. It is now read-only.

Commit 386adc9

Browse files
committed
Merge pull request #68 from hartwig-cordova/fix/cleanup-index
Cleaned up index.js
2 parents 39fa075 + 0b12f7e commit 386adc9

File tree

1 file changed

+20
-30
lines changed

1 file changed

+20
-30
lines changed

src/blackberry10/index.js

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
2-
31
var keyboard,
42
resultObjs = {},
53
threadCallback = null,
6-
_utils = require("../../lib/utils");
7-
_event = require("../../lib/event");
8-
_webview = require("../../lib/webview");
9-
10-
11-
4+
_utils = require("../../lib/utils");
5+
_event = require("../../lib/event");
6+
_webview = require("../../lib/webview");
127

138
module.exports = {
149

@@ -20,34 +15,32 @@ module.exports = {
2015
// communication through the JNEXT plugin to keyboard_js.cpp
2116
startService: function (success, fail, args, env) {
2217
var result = new PluginResult(args, env);
23-
18+
2419
result.ok(keyboard.getInstance().startService(), false);
2520
},
2621
show: function (success, fail, args, env) {
2722
var result = new PluginResult(args, env);
28-
23+
2924
result.ok(keyboard.getInstance().showKeyboard(), false);
3025
},
3126
close: function (success, fail, args, env) {
3227
var result = new PluginResult(args, env);
33-
28+
3429
result.ok(keyboard.getInstance().closeKeyboard(), false);
3530
}
3631
};
3732

3833
keyboardShow = function(a){
3934
_webview.executeJavascript("cordova.plugins.Keyboard.isVisible = true");
4035
_webview.executeJavascript("cordova.fireDocumentEvent('native.keyboardshow',"+a+")");
41-
42-
}
36+
};
4337
keyboardHide = function(){
4438
_webview.executeJavascript("cordova.plugins.Keyboard.isVisible = false");
4539
_webview.executeJavascript("cordova.fireDocumentEvent('native.keyboardhide','')");
46-
47-
}
40+
};
4841
onStart = function() {
49-
_webview.executeJavascript("cordova.exec("+null+", "+null+", 'Keyboard', 'startService', '')");
50-
}
42+
_webview.executeJavascript("cordova.exec("+null+", "+null+", 'Keyboard', 'startService', '')");
43+
};
5144

5245
setTimeout(onStart,2000);
5346

@@ -92,20 +85,18 @@ JNEXT.Keyboard = function () {
9285
return JNEXT.invoke(self.m_id, "closeKeyboard");
9386
};
9487

95-
self.onEvent = function (strData) { // Fired by the Event framework (used by asynchronous callbacks)
88+
self.onEvent = function (strData) { // Fired by the Event framework (used by asynchronous callbacks)
9689
var arData = strData.split(" "),
97-
strEventDesc = arData[0],
98-
jsonData;
99-
100-
if (strEventDesc === "native.keyboardshow") {
101-
jsonData = arData.slice(1, arData.length).join(" ");
102-
keyboardShow(jsonData);
103-
104-
}
105-
else if (strEventDesc === "native.keyboardhide") {
106-
keyboardHide();
107-
}
90+
strEventDesc = arData[0],
91+
jsonData;
10892

93+
if (strEventDesc === "native.keyboardshow") {
94+
jsonData = arData.slice(1, arData.length).join(" ");
95+
keyboardShow(jsonData);
96+
}
97+
else if (strEventDesc === "native.keyboardhide") {
98+
keyboardHide();
99+
}
109100
};
110101

111102
// Thread methods
@@ -132,4 +123,3 @@ JNEXT.Keyboard = function () {
132123
};
133124

134125
keyboard = new JNEXT.Keyboard();
135-

0 commit comments

Comments
 (0)