The OnAsyncWorkExecute method receives an napi_env argument. However, do NOT use it within this method, as it does not run on the JavaScript thread and must not run any method that would cause JavaScript to run. In practice, this means that almost any use of napi_env will be incorrect.
| 5707 | // must not run any method that would cause JavaScript to run. In practice, |
| 5708 | // this means that almost any use of napi_env will be incorrect. |
| 5709 | inline void AsyncWorker::OnAsyncWorkExecute(napi_env env, void* asyncworker) { |
| 5710 | AsyncWorker* self = static_cast<AsyncWorker*>(asyncworker); |
| 5711 | self->OnExecute(env); |
| 5712 | } |
| 5713 | // The OnExecute method receives an napi_env argument. However, do NOT |
| 5714 | // use it within this method, as it does not run on the JavaScript thread and |
| 5715 | // must not run any method that would cause JavaScript to run. In practice, |