PythonMonkey   v1.0.0 (dev)
Loading...
Searching...
No Matches
PromiseType.hh
Go to the documentation of this file.
1
11#ifndef PythonMonkey_PromiseType_
12#define PythonMonkey_PromiseType_
13
14#include <jsapi.h>
15#include <js/Promise.h>
16
17#include <Python.h>
18
23public:
32 static PyObject *getPyObject(JSContext *cx, JS::HandleObject promise);
33
40 static JSObject *toJsPromise(JSContext *cx, PyObject *pyObject);
41};
42
47bool PythonAwaitable_Check(PyObject *obj);
48
56static PyObject *futureOnDoneCallback(PyObject *futureCallbackTuple, PyObject *args);
57
61static bool onResolvedCb(JSContext *cx, unsigned argc, JS::Value *vp);
62
63#endif
bool PythonAwaitable_Check(PyObject *obj)
Check if the object can be used in Python await expression. PyAwaitable_Check hasn't been and has no ...
Definition PromiseType.cc:142
This struct represents the JS Promise type in Python using our custom pythonmonkey....
Definition PromiseType.hh:22
static JSObject * toJsPromise(JSContext *cx, PyObject *pyObject)
Convert a Python awaitable object to JS Promise.
Definition PromiseType.cc:122
static PyObject * getPyObject(JSContext *cx, JS::HandleObject promise)
Construct a new PromiseType object from a JS::PromiseObject.
Definition PromiseType.cc:70