注册事件
Showing
1 changed file
with
30 additions
and
12 deletions
| ... | @@ -45,6 +45,16 @@ AppClient.prototype.getERCode = function (callbackName, callback, jsonStr) { | ... | @@ -45,6 +45,16 @@ AppClient.prototype.getERCode = function (callbackName, callback, jsonStr) { |
| 45 | this.appObj.getERCode('H5', jsonStr); | 45 | this.appObj.getERCode('H5', jsonStr); |
| 46 | } else { | 46 | } else { |
| 47 | this.appObj.callHandler("getERCode", iOSData, callback); | 47 | this.appObj.callHandler("getERCode", iOSData, callback); |
| 48 | this.appObj.registerHandler('postERCode', function(data, responseCallback) { | ||
| 49 | layer.open({ | ||
| 50 | content: JSON.stringify(data), | ||
| 51 | time: 10 | ||
| 52 | }); | ||
| 53 | // log('ObjC called testJavascriptHandler with', data) | ||
| 54 | // var responseData = { 'Javascript Says':'Right back atcha!' } | ||
| 55 | // log('JS responding with', responseData) | ||
| 56 | // responseCallback(responseData) | ||
| 57 | }) | ||
| 48 | } | 58 | } |
| 49 | }; | 59 | }; |
| 50 | AppClient.prototype.getGPS = function (callbackName, callback, jsonStr) { | 60 | AppClient.prototype.getGPS = function (callbackName, callback, jsonStr) { |
| ... | @@ -60,20 +70,28 @@ AppClient.prototype.getGPS = function (callbackName, callback, jsonStr) { | ... | @@ -60,20 +70,28 @@ AppClient.prototype.getGPS = function (callbackName, callback, jsonStr) { |
| 60 | this.appObj.getGPS('H5', jsonStr); | 70 | this.appObj.getGPS('H5', jsonStr); |
| 61 | } else { | 71 | } else { |
| 62 | this.appObj.callHandler("getGPS", iOSData, callback); | 72 | this.appObj.callHandler("getGPS", iOSData, callback); |
| 73 | this.appObj.registerHandler('postGPS', function(data, responseCallback) { | ||
| 74 | layer.open({ | ||
| 75 | content: JSON.stringify(data), | ||
| 76 | time: 10 | ||
| 77 | }); | ||
| 78 | // log('ObjC called testJavascriptHandler with', data) | ||
| 79 | // var responseData = { 'Javascript Says':'Right back atcha!' } | ||
| 80 | // log('JS responding with', responseData) | ||
| 81 | // responseCallback(responseData) | ||
| 82 | }) | ||
| 63 | } | 83 | } |
| 64 | }; | 84 | }; |
| 65 | window.postERCode = function (_params) { | 85 | // |
| 66 | layer.open({ | 86 | // window. = function (_params) { |
| 67 | content: JSON.stringify(_params), | 87 | // |
| 68 | time: 10 | 88 | // } |
| 69 | }); | 89 | // window.postGPS = function (params) { |
| 70 | } | 90 | // layer.open({ |
| 71 | window.postGPS = function (params) { | 91 | // content: JSON.stringify(_params), |
| 72 | layer.open({ | 92 | // time: 10 |
| 73 | content: JSON.stringify(_params), | 93 | // }); |
| 74 | time: 10 | 94 | // } |
| 75 | }); | ||
| 76 | } | ||
| 77 | 95 | ||
| 78 | if(window.android) { | 96 | if(window.android) { |
| 79 | appClient = new AppClient(window.android, true); | 97 | appClient = new AppClient(window.android, true); | ... | ... |
-
Please register or sign in to post a comment