Skip to content

Commit

Permalink
Add FinalizationRegistry implementation
Browse files Browse the repository at this point in the history
1. cleanupCallback is invked by a job (JS_EnqueueJob)
2. registries are stored in JSContext for manage and perform clanup
   callback
3. ensure related jobs are cancled when JSContext release.
  • Loading branch information
LanderlYoung committed Aug 6, 2024
1 parent 8b6bb69 commit 4391fb1
Show file tree
Hide file tree
Showing 7 changed files with 582 additions and 25 deletions.
2 changes: 0 additions & 2 deletions doc/quickjs.texi
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ The following features are not supported yet:

@item Tail calls@footnote{We believe the current specification of tails calls is too complicated and presents limited practical interests.}

@item FinalizationRegistry objects

@end itemize

@subsection ECMA402
Expand Down
1 change: 1 addition & 0 deletions qjsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static const FeatureEntry feature_list[] = {
{ "module-loader", NULL },
{ "bigint", "BigInt" },
{ "weakref", "WeakRef" },
{ "finalization-registry", "FinalizationRegistry" },
};

void namelist_add(namelist_t *lp, const char *name, const char *short_name,
Expand Down
1 change: 1 addition & 0 deletions quickjs-atom.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,6 @@ DEF(Symbol_asyncIterator, "Symbol.asyncIterator")
DEF(Symbol_operatorSet, "Symbol.operatorSet")
#endif
DEF(WeakRef, "WeakRef")
DEF(FinalizationRegistry, "FinalizationRegistry")

#endif /* DEF */
Loading

0 comments on commit 4391fb1

Please sign in to comment.