Skip to content

Commit

Permalink
docs: Fix Promise type in C++
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jan 13, 2025
1 parent f2a9e08 commit bf28dc4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Promises can also be rejected using error throwing syntax on the native side:
<TabItem value="cpp" label="C++">
```cpp title="HybridMath.hpp"
class HybridMath: public HybridMathSpec {
Promise<double> add(double a, double b) override {
std::shared_ptr<Promise<double>> add(double a, double b) override {
return Promise<double>::async([=]() -> double {
if (a < 0 || b < 0) {
throw std::runtime_error("Value cannot be negative!");
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/sync-vs-async.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ On the native side you still start out with a synchronous method, but you can re
<TabItem value="cpp" label="C++">
```cpp title="HybridMiner.hpp"
class HybridMiner: public HybridMinerSpec {
Promise<double> mineOneBitcoin() override {
std::shared_ptr<Promise<double>> mineOneBitcoin() override {
// 1. synchronous in here, JS Thread is still blocked
// useful e.g. for argument checking before starting async Thread
return Promise<double>::async([]() {
Expand Down

0 comments on commit bf28dc4

Please sign in to comment.