Skip to content

Commit

Permalink
Merge pull request uknownothingsnow#65 from mason-Wang/master
Browse files Browse the repository at this point in the history
Check the responseCallback before call it
  • Loading branch information
uknownothingsnow committed Dec 14, 2017
2 parents 9d19d28 + a861268 commit eebad3f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions example/src/main/assets/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,22 @@
var data = {
'Javascript Responds': '测试中文!'
};
console.log('JS responding with', data);
responseCallback(data);

if (responseCallback) {
console.log('JS responding with', data);
responseCallback(data);
}
});

bridge.registerHandler("functionInJs", function(data, responseCallback) {
document.getElementById("show").innerHTML = ("data from Java: = " + data);
var responseData = "Javascript Says Right back aka!";
responseCallback(responseData);
if (responseCallback) {
var responseData = "Javascript Says Right back aka!";
responseCallback(responseData);
}
});
})
</script>

</html>
</html>

0 comments on commit eebad3f

Please sign in to comment.