Skip to content

Commit

Permalink
Fix #13 - Add Fallback for Node.js Versions lower than 10.x
Browse files Browse the repository at this point in the history
`npm test` now fails when running at this commit, but
only with node versions < 10.x. This needs to be addressed. In the
worst case we just make the test pass when such a version is used.
It's not a a nice solution, but I didn't find any documentation on
how to make C++ Addons work when re-requiring them after clearing
the require-cache so far. I will keep looking though :)
  • Loading branch information
schroffl committed Oct 24, 2018
1 parent 1f12433 commit 634b1c7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/lzo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ void Init(Local<Object> exports, Local<Context> context) {
String::NewFromUtf8(isolate, lzo_version_date()));
}

// Initialize this addon to be context-aware.
NODE_MODULE_INIT(/* exports, module, context */) {
Init(exports, context);
}
#if NODE_MAJOR_VERSION >= 10
// Initialize this addon to be context-aware. See Issue #11
NODE_MODULE_INIT(/* exports, module, context */) {
Init(exports, context);
}
#else
// For backwards compatibility. See Issue #13
NODE_MODULE(node_lzo, Init)
#endif

0 comments on commit 634b1c7

Please sign in to comment.