René's URL Explorer Experiment


Title: Support for Promises/A+? · Issue #180 · joeferner/node-java · GitHub

Open Graph Title: Support for Promises/A+? · Issue #180 · joeferner/node-java

X Title: Support for Promises/A+? · Issue #180 · joeferner/node-java

Description: Joe, would you consider adding support for Promises/A+ (i.e. merging a PR if I prepared one)? Currently node-java creates two javascript methods for every method of a class, an async version with the same name, and a sync version with th...

Open Graph Description: Joe, would you consider adding support for Promises/A+ (i.e. merging a PR if I prepared one)? Currently node-java creates two javascript methods for every method of a class, an async version with t...

X Description: Joe, would you consider adding support for Promises/A+ (i.e. merging a PR if I prepared one)? Currently node-java creates two javascript methods for every method of a class, an async version with t...

Opengraph URL: https://github.com/joeferner/node-java/issues/180

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support for Promises/A+?","articleBody":"Joe, would you consider adding support for [Promises/A+](https://promisesaplus.com/) (i.e. merging a PR if I prepared one)? Currently node-java creates two javascript methods for every method of a class, an async version with the same name, and a sync version with the 'Sync' suffix. We'd like to have a third variant, which is async but returning a promise. We have used both Q and Bluebird. I believe it is possible to implement a solution that would let users of node-java choose which promises library they would use, by simply adding to the node-java API the ability to pass in a 'promisify' function.\n\nSomething along the lines of:\n\n``` javascript\nvar java = require('java');\nvar asyncOptions = {\n  promisify: require('q').nfbind     // or require('bluebird').promisify\n  suffix: 'Promise'\n};\njava.setAsyncOptions(asyncOptions);\njava.classpath.push(...);\n...\n```\n\nI use 'asyncOptions' instead of 'promisesOptions' since I imagine the possibility of disabling the generation of callback-style async methods, and only using promises.\n\nI've started inspecting the current node-java sources to figure out how to implement the change. There are some easy changes that can be made in lib/nodeJavaBridge.js, and perhaps that is the right place to promisify static methods, with code along these lines:\n\n``` javascript\n// copy static methods\nvar methods = clazz.getDeclaredMethodsSync();\nfor (i = 0; i \u003c methods.length; i++) {\n  if (((methods[i].getModifiersSync() & MODIFIER_PUBLIC) === MODIFIER_PUBLIC)\n    && ((methods[i].getModifiersSync() & MODIFIER_STATIC) === MODIFIER_STATIC)) {\n    var methodName = methods[i].getNameSync();\n    result[methodName + 'Sync'] = java.callStaticMethodSync.bind(java, name, methodName);\n    result[methodName] = java.callStaticMethod.bind(java, name, methodName);\n    result[methodName + asyncOptions.suffix ] = asyncOptions.promisify(result[methodName]);   // Add just this one line\n  }\n}\n```\n\nPromisifying instance methods is harder. It requires knowledge of v8 and nan that I don't yet have. I see that maybe the key changes would be localized to a few lines in javaObject.cpp, in the loop across instance methods around lines 45 to 56. I can probably figure it out with more study of the documentation for v8 and nan, but I wonder if you might be able to help me out with that part?\n","author":{"url":"https://github.com/jimlloyd","@type":"Person","name":"jimlloyd"},"datePublished":"2015-01-05T16:49:36Z","url":"https://github.com/joeferner/node-java/issues/180"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4cd1ae40-e6c6-8ae2-2ce0-551d2c65ef45
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9252:1007B2:90D17:CBCEF:6AFD4A74
html-safe-nonce8d5936438110abc0d9d534febfc4cbdf3cdcc1db8cf4ce67728da275c018962e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjUyOjEwMDdCMjo5MEQxNzpDQkNFRjo2QUZENEE3NCIsInZpc2l0b3JfaWQiOiIxNjkzMjE5MTY2NjQ4ODc5NzMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac455f63b369b9c95d63ca8a26bf1de54db07f1bf42c7ea29ee814804d4e029cb2
hovercard-subject-tagissue:53416541
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/joeferner/node-java/180/issue_layout
twitter:imagehttps://opengraph.githubassets.com/7486546acdd4104759fedebaa6fd2d692e388fba9db0ff36f1c8f8c3b3309671/joeferner/node-java/issues/180
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/7486546acdd4104759fedebaa6fd2d692e388fba9db0ff36f1c8f8c3b3309671/joeferner/node-java/issues/180
og:image:altJoe, would you consider adding support for Promises/A+ (i.e. merging a PR if I prepared one)? Currently node-java creates two javascript methods for every method of a class, an async version with t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejimlloyd
hostnamegithub.com
expected-hostnamegithub.com
None66653c2e55a6fff2930be1bdf07ee4f8aa137e3956d056c822563be6f878755e
turbo-cache-controlno-preview
go-importgithub.com/joeferner/node-java git https://github.com/joeferner/node-java.git
octolytics-dimension-user_id808857
octolytics-dimension-user_loginjoeferner
octolytics-dimension-repository_id3228734
octolytics-dimension-repository_nwojoeferner/node-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3228734
octolytics-dimension-repository_network_root_nwojoeferner/node-java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb6f01f7cb9f35f8c09949773241a3d49dd04b340
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/joeferner/node-java/issues/180#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fjoeferner%2Fnode-java%2Fissues%2F180
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fjoeferner%2Fnode-java%2Fissues%2F180
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=joeferner%2Fnode-java
Reloadhttps://github.com/joeferner/node-java/issues/180
Reloadhttps://github.com/joeferner/node-java/issues/180
Reloadhttps://github.com/joeferner/node-java/issues/180
joefernerhttps://github.com/joeferner
node-javahttps://github.com/joeferner/node-java
Codehttps://github.com/joeferner/node-java
Issues208 (208)https://github.com/joeferner/node-java/issues
Pull requests2 (2)https://github.com/joeferner/node-java/pulls
Actionshttps://github.com/joeferner/node-java/actions
Projectshttps://github.com/joeferner/node-java/projects
Wikihttps://github.com/joeferner/node-java/wiki
Security and qualityhttps://github.com/joeferner/node-java/security
Insightshttps://github.com/joeferner/node-java/pulse
https://github.com/joeferner/node-java
New issuehttps://github.com/login?return_to=https://github.com/joeferner/node-java/issues/180
New issuehttps://github.com/login?return_to=https://github.com/joeferner/node-java/issues/180
Support for Promises/A+?https://github.com/joeferner/node-java/issues/180#top
https://github.com/jimlloyd
jimlloydhttps://github.com/jimlloyd
on Jan 5, 2015https://github.com/joeferner/node-java/issues/180#issue-53416541
Promises/A+https://promisesaplus.com/
https://github.com/joeferner
joefernerhttps://github.com/joeferner
on Jan 6, 2015https://github.com/joeferner/node-java/issues/180#issuecomment-68861401
https://github.com/jimlloyd
jimlloydhttps://github.com/jimlloyd
on Jan 6, 2015https://github.com/joeferner/node-java/issues/180#issuecomment-68953703
#181https://github.com/joeferner/node-java/pull/181
https://github.com/joeferner
joefernerhttps://github.com/joeferner
on Jan 14, 2015https://github.com/joeferner/node-java/issues/180#issuecomment-69985436
jimlloydhttps://github.com/jimlloyd
completedhttps://github.com/joeferner/node-java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jan 14, 2015https://github.com/joeferner/node-java/issues/180#event-219025148
Sign up for freehttps://github.com/signup?return_to=https://github.com/joeferner/node-java/issues/180
Sign in to commenthttps://github.com/login?return_to=https://github.com/joeferner/node-java/issues/180
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.