v8toolkit
0.0.1
Utility library for embedding V8 Javascript engine in a c++ program
|
#include <sample2.h>
Public Member Functions | |
JSWrapper (v8::Local< v8::Context > context, v8::Local< v8::Object > object, v8::Local< v8::FunctionTemplate > created_by) | |
v8::Local< v8::Object > | get_javascript_object () const |
Protected Types | |
using | BASE_TYPE = Base |
Protected Attributes | |
v8::Isolate * | isolate |
v8::Global< v8::Context > | global_context |
v8::Global< v8::Object > | global_js_object |
v8::Global< v8::FunctionTemplate > | global_created_by |
bool | called_from_javascript = false |
C++ types to be extended in javascript must inherit from this class. Example: class MyClass{}; class JSMyClass : public MyClass, public JSWrapper {}; Now, JSMyClass can be used as a MyClass, but will intercept calls to its methods and attempt to use the javascript object to fulfill them, falling back to the C++ class methods of MyClass when necessary Any class inheriting from this (e.g. JSMyClass) must have the first two parameters of its constructor be a v8::Local<v8::Context>, v8::Local<v8::Object>
|
protected |
Definition at line 78 of file bidirectional.h.
|
inline |
Definition at line 81 of file bidirectional.h.
|
inlineinherited |
Definition at line 61 of file bidirectional.h.
Referenced by v8toolkit::CastToJS< JSWrapper< T > >::operator()().
|
protectedinherited |
Definition at line 38 of file bidirectional.h.
|
protectedinherited |
Definition at line 39 of file bidirectional.h.
|
protectedinherited |
Definition at line 40 of file bidirectional.h.
|
protectedinherited |
Definition at line 41 of file bidirectional.h.
|
mutableprotectedinherited |
It's easy to end up in infinite recursion where the JSWrapper object looks for a javascript implementation to call instead of calling the native C++ implementation, but finds its own JS_ACCESS function that its already in an proceeds to call itself. This flag stops that from happening - at least in naive situations. Marked as mutable because it needs to be changed even from within const methods
Definition at line 49 of file bidirectional.h.