-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow CxxModules to implement methods with two callbacks (#21586)
Summary: When writing a native module in C++ using CxxModule, its not currently possible to write async methods which take two callbacks, that shouldn't be projected to JS as a promise. I hit this when trying to implement the AppState module in c++. AppState has a single method on it, getCurrentAppState, which takes two callbacks (a success and a failure callback). This change adds a couple of new CxxModule::Method ctors, which allow devs to specify that they want two callbacks, but not a promise. This is done using an extra tag in the ctor, similar to how you specify that you want to make a synchronous method. I used the existing AsyncTag to indicate that the 2 callback version should be async, and not a promise. Pull Request resolved: #21586 Reviewed By: shergin Differential Revision: D10520204 Pulled By: fkgozali fbshipit-source-id: bcb2dbd91cba3c1db987dc18960247218fdbc032
- Loading branch information
1 parent
11d4512
commit 8826d8b
Showing
2 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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