On Fri, Jul 8, 2016 at 7:56 AM, Abhishek Singh <[email protected]> wrote: > Is it a requirement that all interceptor functions passed to > "NamedPropertyHandlerConfiguration" need to be static? Looking at couple of > examples, it looks pretty restrictive. > > This is how I've designed my application around v8. > > class Database { > public: > Database(Worker* w); > ~Database(); > ... > ... > static DB::Client* DB_conn_obj; > > private: > bool InstallMaps(map<string, string>* bucket); > > static Local<ObjectTemplate> MakeDBMapTemplate(Isolate* isolate); > > static void DBGet(Local<Name> name, > const PropertyCallbackInfo<Value>& info); > static void DBSet(Local<Name> name, Local<Value> value, > const PropertyCallbackInfo<Value>& info); > static void DBDelete(Local<Name> name, > const PropertyCallbackInfo<Boolean>& info); > > ... > }; > > Interceptors functions like DBGet/DBSet/DBDelete need to use a DB::Client > connection handle and I had to make it static for things to work. But in > this model, I can't connect to multiple databases because each DB needs a > unique connection handle - so Ideally I would require non-static, object > specific connection handle. > > Any suggestion on how to overcome this limitation?
NamedPropertyHandlerConfiguration() takes a Local<Value> as its second-to-last argument that is passed to your callbacks. You can wrap a pointer with v8::External::New() and unwrap it in your callbacks. HTH. -- -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
