{"action":"created","issue":{"url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/8","repository_url":"https://api.github.com/repos/ericwlange/AndroidJSCore","labels_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/8/comments","events_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/8/events","html_url":"https://github.com/ericwlange/AndroidJSCore/issues/8","id":123623161,"number":8,"title":"How to call a JavaScript function","user":{"login":"aexmachina","id":261804,"avatar_url":"https://avatars1.githubusercontent.com/u/261804?v=4","gravatar_id":"","url":"https://api.github.com/users/aexmachina","html_url":"https://github.com/aexmachina","followers_url":"https://api.github.com/users/aexmachina/followers","following_url":"https://api.github.com/users/aexmachina/following{/other_user}","gists_url":"https://api.github.com/users/aexmachina/gists{/gist_id}","starred_url":"https://api.github.com/users/aexmachina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aexmachina/subscriptions","organizations_url":"https://api.github.com/users/aexmachina/orgs","repos_url":"https://api.github.com/users/aexmachina/repos","events_url":"https://api.github.com/users/aexmachina/events{/privacy}","received_events_url":"https://api.github.com/users/aexmachina/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2015-12-23T08:58:11Z","updated_at":"2017-12-13T08:58:20Z","closed_at":"2015-12-24T01:42:19Z","author_association":"CONTRIBUTOR","body":"Sorry if I'm being dense, but how do I call a JavaScript function on an JavaScript object? Do I need to assign it to a global variable and use `evaluateScript()`?\n"},"comment":{"url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/comments/351326008","html_url":"https://github.com/ericwlange/AndroidJSCore/issues/8#issuecomment-351326008","issue_url":"https://api.github.com/repos/ericwlange/AndroidJSCore/issues/8","id":351326008,"user":{"login":"NitishAgrawal","id":13213134,"avatar_url":"https://avatars1.githubusercontent.com/u/13213134?v=4","gravatar_id":"","url":"https://api.github.com/users/NitishAgrawal","html_url":"https://github.com/NitishAgrawal","followers_url":"https://api.github.com/users/NitishAgrawal/followers","following_url":"https://api.github.com/users/NitishAgrawal/following{/other_user}","gists_url":"https://api.github.com/users/NitishAgrawal/gists{/gist_id}","starred_url":"https://api.github.com/users/NitishAgrawal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NitishAgrawal/subscriptions","organizations_url":"https://api.github.com/users/NitishAgrawal/orgs","repos_url":"https://api.github.com/users/NitishAgrawal/repos","events_url":"https://api.github.com/users/NitishAgrawal/events{/privacy}","received_events_url":"https://api.github.com/users/NitishAgrawal/received_events","type":"User","site_admin":false},"created_at":"2017-12-13T08:58:20Z","updated_at":"2017-12-13T08:58:20Z","author_association":"NONE","body":"Thanks for your help now I am able to evaluate script by below code \r\ntry {\r\n            JSContext context = new JSContext();\r\n            InputStream is=getAssets().open(\"bundle.js\");\r\n            try {\r\n                context.evaluateScript(convertStreamToString(is));\r\n                JSObject sdk = context.property(\"myObjectName\").toObject();\r\n                JSValue genMne = sdk.property(\"myFunctionName\");\r\n                JSFunction func = genMne.toObject().toFunction();\r\n                JSValue result = func.call(null );\r\n            } finally {\r\n                is.close();\r\n            }"}}
{"actor":{"display_login":"NitishAgrawal"}}