Unpin node-addon-api, cast CallbackInfo access to size_t

See https://github.com/nodejs/node-addon-api/pull/1253
This commit is contained in:
Lovell Fuller
2023-01-16 09:00:42 +00:00
parent a9bd0e79f8
commit bdc50e1d6e
6 changed files with 24 additions and 22 deletions

View File

@@ -172,7 +172,7 @@ class StatsWorker : public Napi::AsyncWorker {
Napi::Value stats(const Napi::CallbackInfo& info) {
// V8 objects are converted to non-V8 types held in the baton struct
StatsBaton *baton = new StatsBaton;
Napi::Object options = info[0].As<Napi::Object>();
Napi::Object options = info[size_t(0)].As<Napi::Object>();
// Input
baton->input = sharp::CreateInputDescriptor(options.Get("input").As<Napi::Object>());
@@ -182,7 +182,7 @@ Napi::Value stats(const Napi::CallbackInfo& info) {
Napi::Function debuglog = options.Get("debuglog").As<Napi::Function>();
// Join queue for worker thread
Napi::Function callback = info[1].As<Napi::Function>();
Napi::Function callback = info[size_t(1)].As<Napi::Function>();
StatsWorker *worker = new StatsWorker(callback, baton, debuglog);
worker->Receiver().Set("options", options);
worker->Queue();