Created
September 4, 2021 02:18
-
-
Save jakecyr/1341d20b8487a6b845d61ad5bb4673d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Napi::String TriggerCallback(const Napi::CallbackInfo& info) { | |
| Napi::Env env = info.Env(); | |
| if (!callbackWasSet) { | |
| throw Napi::Error::New(env, "Callback was never set"); | |
| } | |
| Napi::String napiMessageString = info[0].As<Napi::String>(); | |
| auto callback = [napiMessageString](Napi::Env env, Napi::Function jsCallback) { | |
| jsCallback.Call({napiMessageString}); | |
| }; | |
| threadSafeCallback.NonBlockingCall(callback); | |
| threadSafeCallback.Release(); | |
| return Napi::String::New(env, "Done"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment