Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: propagate async context #199

Merged
merged 2 commits into from Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion fsevents.cc
Expand Up @@ -41,6 +41,7 @@ namespace fse {
void threadStop();

// methods.cc - internal
Nan::AsyncResource async_resource;
Nan::Callback *handler;
void emitEvent(const char *path, UInt32 flags, UInt64 id);

Expand All @@ -59,7 +60,8 @@ namespace fse {

using namespace fse;

FSEvents::FSEvents(const char *path, Nan::Callback *handler): handler(handler) {
FSEvents::FSEvents(const char *path, Nan::Callback *handler)
: async_resource("fsevents:FSEvents"), handler(handler) {
CFStringRef dirs[] = { CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8) };
paths = CFArrayCreate(NULL, (const void **)&dirs, 1, NULL);
threadloop = NULL;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -4,7 +4,7 @@
"description": "Native Access to Mac OS-X FSEvents",
"main": "fsevents.js",
"dependencies": {
"nan": "^2.3.0",
"nan": "^2.9.2",
"node-pre-gyp": "^0.6.39"
},
"os": [
Expand Down
2 changes: 1 addition & 1 deletion src/methods.cc
Expand Up @@ -11,7 +11,7 @@ void FSEvents::emitEvent(const char *path, UInt32 flags, UInt64 id) {
Nan::New<v8::Number>(flags),
Nan::New<v8::Number>(id)
};
handler->Call(3, argv);
handler->Call(3, argv, &async_resource);
}

NAN_METHOD(FSEvents::New) {
Expand Down