IncludeJS  0.0.1
Build your own JavaScript runtime
engine_promise.h
1 #ifndef INCLUDEJS_ENGINE_PROMISE_H_
2 #define INCLUDEJS_ENGINE_PROMISE_H_
3 
4 #include "engine_export.h"
5 
6 #include <includejs/engine_value.h>
7 
8 #include <memory> // std::unique_ptr
9 
10 namespace includejs {
11 
13 class INCLUDEJS_ENGINE_EXPORT Promise {
14 public:
15  // Consumers are not meant to create this class directly
16 #ifndef DOXYGEN
17  Promise(const void *context);
18  ~Promise();
19 #endif
20  auto resolve(Value result) -> void;
21  auto reject(Value error) -> void;
22  auto value() -> Value;
23 
24 private:
25  struct Internal;
26  std::unique_ptr<Internal> internal;
27  bool completed{false};
28 };
29 } // namespace includejs
30 
31 #endif
Definition: engine_promise.h:13
Definition: engine_value.h:30