Title: Missing module in Init · Issue #449 · nodejs/node-addon-api · GitHub
Open Graph Title: Missing module in Init · Issue #449 · nodejs/node-addon-api
X Title: Missing module in Init · Issue #449 · nodejs/node-addon-api
Description: With the legacy api, I could obtain the addon module using this code: void Init(Local
Open Graph Description: With the legacy api, I could obtain the addon module using this code: void Init(Local
X Description: With the legacy api, I could obtain the addon module using this code: void Init(Local<Object> exports, Local<Object> module) { NODE_SET_METHOD(module, "exports", CreateObject)...
Opengraph URL: https://github.com/nodejs/node-addon-api/issues/449
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Missing module in Init","articleBody":"With the legacy api, I could obtain the addon module using this code:\r\n```\r\nvoid Init(Local\u003cObject\u003e exports, Local\u003cObject\u003e module) {\r\n NODE_SET_METHOD(module, \"exports\", CreateObject);\r\n}\r\nNODE_MODULE(NODE_GYP_MODULE_NAME, Init)\r\n```\r\nI need the module to obtain the addon filename (and folder) using this code:\r\n```\r\nstd::string static GetModuleFilename(v8::Handle\u003cv8::Object\u003e module)\r\n{\r\n Isolate* isolate = Isolate::GetCurrent();\r\n auto v8filename = module-\u003eGet(v8::String::NewFromUtf8(isolate, \"filename\"));\r\n auto filename = NodeTypes::FromV8String(v8filename);\r\n return filename;\r\n}\r\n```\r\nHow can I get the **module** and the **filename** at initialization time now?\r\n","author":{"url":"https://github.com/raffaeler","@type":"Person","name":"raffaeler"},"datePublished":"2019-02-17T21:04:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":36},"url":"https://github.com/449/node-addon-api/issues/449"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d7b7e239-cce0-a3ce-ec16-9013cb703347 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CAAC:E7634:206EB3A:2E531E5:6A50EA76 |
| html-safe-nonce | 3df42480c2a0f43cc61691a1536227c372f283ef037dac41312429f2089bf0cb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQUFDOkU3NjM0OjIwNkVCM0E6MkU1MzFFNTo2QTUwRUE3NiIsInZpc2l0b3JfaWQiOiIxMTQ0NTIzMjE3NTM0MjQ5NTkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e6f6863ab5b1891dc82349d6a1f62b06da7cfb1156034dc714c281a59f1509d3 |
| hovercard-subject-tag | issue:411234879 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node-addon-api/449/issue_layout |
| twitter:image | https://opengraph.githubassets.com/846061a474850bf63ee22bdbf4199eb550298faecbac6c5b72a44d9329e391c5/nodejs/node-addon-api/issues/449 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/846061a474850bf63ee22bdbf4199eb550298faecbac6c5b72a44d9329e391c5/nodejs/node-addon-api/issues/449 |
| og:image:alt | With the legacy api, I could obtain the addon module using this code: void Init(Local |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | raffaeler |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node-addon-api git https://github.com/nodejs/node-addon-api.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 81384578 |
| octolytics-dimension-repository_nwo | nodejs/node-addon-api |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81384578 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node-addon-api |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb19d617b534959801b4b7453938ecf1dfa22131 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width