Skip to content

Commit

Permalink
fix(build): use GetCreationContextChecked for node >= 18
Browse files Browse the repository at this point in the history
  • Loading branch information
dbousque committed Nov 15, 2023
1 parent 8909e85 commit f96387c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "20"
- "11"
- "8"
env:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "posix-semaphore",
"version": "1.0.0",
"version": "1.0.1",
"description": "Blocking POSIX semaphores for Node.js",
"repository": "https://github.com/dbousque/posix-semaphore",
"license": "MIT",
Expand All @@ -14,7 +14,7 @@
},
"devDependencies": {
"child_process": "^1.0.2",
"shm-typed-array": "^0.0.10"
"shm-typed-array": "^0.1.0"
},
"dependencies": {
"bindings": "~1.2.1",
Expand Down
5 changes: 5 additions & 0 deletions srcs/semaphore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ Semaphore::~Semaphore()

void Semaphore::Init(v8::Local<v8::Object> exports)
{
#if NODE_MAJOR_VERSION >= 18
v8::Local<v8::Context> context = exports->GetCreationContextChecked();
#else
v8::Local<v8::Context> context = exports->CreationContext();
#endif

Nan::HandleScope scope;

// Prepare constructor template
Expand Down

0 comments on commit f96387c

Please sign in to comment.