Skip to content

Commit 8a8708c

Browse files
Commit
1 parent 1a5c891 commit 8a8708c

2 files changed

Lines changed: 6 additions & 15 deletions

File tree

dist/addon.node

-512 Bytes
Binary file not shown.

native-src/sync_root_interface/callbacks/FetchData/FetchData.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,11 @@ napi_threadsafe_function g_fetch_data_threadsafe_callback = nullptr;
2323

2424
#define CHUNK_SIZE (32 * 1024 * 1024)
2525

26-
napi_value create_response(napi_env env, bool finished, float progress)
26+
napi_value create_response(napi_env env, bool finished)
2727
{
28-
napi_value result_object;
29-
napi_create_object(env, &result_object);
30-
31-
napi_value finished_value;
32-
napi_get_boolean(env, finished, &finished_value);
33-
napi_set_named_property(env, result_object, "finished", finished_value);
34-
35-
napi_value progress_value;
36-
napi_create_double(env, progress, &progress_value);
37-
napi_set_named_property(env, result_object, "progress", progress_value);
38-
39-
return result_object;
28+
napi_value result;
29+
napi_get_boolean(env, finished, &result);
30+
return result;
4031
}
4132

4233
size_t file_incremental_reading(napi_env env, TransferContext &ctx, bool final_step, float &progress)
@@ -120,7 +111,7 @@ napi_value response_callback_fn_fetch_data(napi_env env, napi_callback_info info
120111
ctx->ready = true;
121112
ctx->cv.notify_one();
122113

123-
return create_response(env, true, 0);
114+
return create_response(env, true);
124115
}
125116

126117
wprintf(L"Download tmp path: %s\n", tmpPath.c_str());
@@ -151,7 +142,7 @@ napi_value response_callback_fn_fetch_data(napi_env env, napi_callback_info info
151142

152143
wprintf(L"Fetch data finished: %d, progress: %.2f\n", ctx->loadFinished, progress);
153144

154-
return create_response(env, ctx->loadFinished, progress);
145+
return create_response(env, ctx->loadFinished);
155146
}
156147

157148
void notify_fetch_data_call(napi_env env, napi_value js_callback, void *context, void *data)

0 commit comments

Comments
 (0)