Skip to content

Commit

Permalink
src: use MakeCallback() -> Call() in AsyncWorker
Browse files Browse the repository at this point in the history
Change `AsyncWorker::OnOK()` and `AsyncWorker::OnError()` callbacks to
**NOT** use `MakeCallback()`. An ordinary function call
(`_callback::Call()`) is now correct.

PR-URL: #361
Refs: https://nodejs.org/api/n-api.html#n_api_napi_make_callback
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@NickNaso.local>
  • Loading branch information
romandev authored and mhdawson committed Oct 22, 2018
1 parent 2342415 commit fa3a615
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3588,11 +3588,11 @@ inline FunctionReference& AsyncWorker::Callback() {
}

inline void AsyncWorker::OnOK() {
_callback.MakeCallback(_receiver.Value(), std::initializer_list<napi_value>{});
_callback.Call(_receiver.Value(), std::initializer_list<napi_value>{});
}

inline void AsyncWorker::OnError(const Error& e) {
_callback.MakeCallback(_receiver.Value(), std::initializer_list<napi_value>{ e.Value() });
_callback.Call(_receiver.Value(), std::initializer_list<napi_value>{ e.Value() });
}

inline void AsyncWorker::SetError(const std::string& error) {
Expand Down

0 comments on commit fa3a615

Please sign in to comment.