Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3395059
D9269.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9269.diff
View Options
diff --git a/native/native_rust_library/RustCallback.h b/native/native_rust_library/RustCallback.h
--- a/native/native_rust_library/RustCallback.h
+++ b/native/native_rust_library/RustCallback.h
@@ -5,5 +5,6 @@
namespace comm {
void stringCallback(rust::String error, uint32_t promiseID, rust::String ret);
+void voidCallback(rust::String error, uint32_t promiseID);
} // namespace comm
diff --git a/native/native_rust_library/RustCallback.cpp b/native/native_rust_library/RustCallback.cpp
--- a/native/native_rust_library/RustCallback.cpp
+++ b/native/native_rust_library/RustCallback.cpp
@@ -23,4 +23,17 @@
}
}
+void voidCallback(rust::String error, uint32_t promiseID) {
+ auto it = RustPromiseManager::instance.promises.find(promiseID);
+ if (it == RustPromiseManager::instance.promises.end()) {
+ return;
+ }
+
+ if (error.size()) {
+ RustPromiseManager::instance.rejectPromise(promiseID, std::string(error));
+ } else {
+ RustPromiseManager::instance.resolvePromise(promiseID, folly::dynamic());
+ }
+}
+
} // namespace comm
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 1:23 AM (7 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2606418
Default Alt Text
D9269.diff (1 KB)
Attached To
Mode
D9269: [native] helper functions for resolving JS promises with void
Attached
Detach File
Event Timeline
Log In to Comment