1-
2-
31var 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
138module . 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
3833keyboardShow = function ( a ) {
3934 _webview . executeJavascript ( "cordova.plugins.Keyboard.isVisible = true" ) ;
4035 _webview . executeJavascript ( "cordova.fireDocumentEvent('native.keyboardshow'," + a + ")" ) ;
41-
42- }
36+ } ;
4337keyboardHide = function ( ) {
4438 _webview . executeJavascript ( "cordova.plugins.Keyboard.isVisible = false" ) ;
4539 _webview . executeJavascript ( "cordova.fireDocumentEvent('native.keyboardhide','')" ) ;
46-
47- }
40+ } ;
4841onStart = function ( ) {
49- _webview . executeJavascript ( "cordova.exec(" + null + ", " + null + ", 'Keyboard', 'startService', '')" ) ;
50- }
42+ _webview . executeJavascript ( "cordova.exec(" + null + ", " + null + ", 'Keyboard', 'startService', '')" ) ;
43+ } ;
5144
5245setTimeout ( 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
134125keyboard = new JNEXT . Keyboard ( ) ;
135-
0 commit comments