Skip to content

Add implementation for napi_add_finalizer - #73

Merged
bghgary merged 3 commits into
BabylonJS:mainfrom
bghgary:jsc-finalizer
Feb 1, 2024
Merged

Add implementation for napi_add_finalizer#73
bghgary merged 3 commits into
BabylonJS:mainfrom
bghgary:jsc-finalizer

Conversation

@bghgary

@bghgarybghgary commented Feb 1, 2024

Copy link
Copy Markdown
Contributor

@bghgary

bghgary commented Feb 1, 2024

Copy link
Copy Markdown
ContributorAuthor

This is a stopgap implementation that needs a more comprehensive implementation for all JS engines once this PR is merged.

Tested manually with macOS with the following code:

auto obj = Napi::ArrayBuffer::New(env, 1000000);
napi_add_finalizer(env, obj, const_cast<char*>("blah"), [](napi_env, void* finalize_data, void*) {
constchar* message = static_cast<constchar*>(finalize_data);
NSLog(@"napi_add_finalizer: callback: %s", message);
}, nullptr, nullptr);

@PolygonalSunPolygonalSun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bghgary
bghgary enabled auto-merge (squash) February 1, 2024 22:27
@bghgary
bghgary merged commit c147df4 into BabylonJS:mainFeb 1, 2024
bghgary added a commit to BabylonJS/BabylonNative that referenced this pull request Feb 5, 2024
See #1351. This a stopgap solution. Proper implementation needs to
happen after BabylonJS/JsRuntimeHost#73 is
merged.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@bghgary@PolygonalSun