Skip to content

Commit 70e33c1

Browse files
committed
compile on 0.10
1 parent 0c4e4ba commit 70e33c1

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/appmetrics.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,11 @@ NAN_METHOD(getOption) {
304304
if (info.Length() > 0) {
305305
Local<String> value = info[0]->ToString();
306306
std::string property = loaderApi->getProperty(toStdString(value).c_str());
307+
#if NODE_VERSION_AT_LEAST(0, 11, 0) // > v0.11+
307308
v8::Local<v8::String> v8str = v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), property.c_str());
309+
#else
310+
v8::Local<v8::String> v8str = v8::String::New(property.c_str(), strlen(property.c_str()));
311+
#endif
308312
info.GetReturnValue().Set<v8::String>(v8str);
309313
} else {
310314
loaderApi->logMessage(warning, "Incorrect number of parameters passed to getOption");
@@ -331,8 +335,10 @@ NAN_METHOD(start) {
331335
NAN_METHOD(stop) {
332336

333337
if (running) {
338+
printf("running");
334339
running = false;
335340
loaderApi->stop();
341+
printf("stopped loaderApi");
336342
loaderApi->shutdown();
337343
headless::stop();
338344
}

src/headlessutils.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,18 @@ uv_async_t async_zip;
3333
uv_loop_t* loop;
3434
const char* outputDir;
3535

36+
#if NODE_VERSION_AT_LEAST(0, 11, 0) // > v0.11+
3637
void asyncfunc(uv_async_t* handle) {
38+
#else
39+
void asyncfunc(uv_async_t* handle, int status) {
40+
#endif
3741
Nan::HandleScope scope;
3842
v8::Isolate* isolate = v8::Isolate::GetCurrent();
39-
v8::Local<v8::Value> argv[] = { v8::String::NewFromUtf8(isolate, outputDir) };
43+
#if NODE_VERSION_AT_LEAST(0, 11, 0) // > v0.11+
44+
v8::Local<v8::Value> argv[] = { v8::String::NewFromUtf8(isolate, outputDir) };
45+
#else
46+
v8::Local<v8::Value> argv[] = { v8::String::New(outputDir, strlen(outputDir)) };
47+
#endif
4048
headless::zipFunction->Call(1, argv);
4149
}
4250

@@ -49,7 +57,9 @@ void start() {
4957
}
5058

5159
void stop() {
60+
printf(">> stop");
5261
uv_close((uv_handle_t*) &async_zip, NULL);
62+
printf("<< stop");
5363
}
5464

5565
void zip(const char* dir) {

0 commit comments

Comments
 (0)