Skip to content

Commit f91b4fe

Browse files
committed
Use the default loop when running on node 9 or earlier
1 parent c7bdf1f commit f91b4fe

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/database.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ NAN_METHOD(Database::New) {
127127
callback = Local<Function>::Cast(info[pos++]);
128128
}
129129

130-
Database* db = new Database(node::GetCurrentEventLoop(info.GetIsolate()));
130+
#if NODE_MODULE_VERSION > NODE_9_0_MODULE_VERSION
131+
uv_loop_t* loop = node::GetCurrentEventLoop(info.GetIsolate());
132+
#else
133+
uv_loop_t* loop = uv_default_loop();
134+
#endif
135+
Database* db = new Database(loop);
131136
db->Wrap(info.This());
132137

133138
Nan::ForceSet(info.This(), Nan::New("filename").ToLocalChecked(), info[0].As<String>(), ReadOnly);

0 commit comments

Comments
 (0)