本文整理汇总了C++中v8::Persistent::IsCallable方法的典型用法代码示例。如果您正苦于以下问题:C++ Persistent::IsCallable方法的具体用法?C++ Persistent::IsCallable怎么用?C++ Persistent::IsCallable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类v8::Persistent
的用法示例。
在下文中一共展示了Persistent::IsCallable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NotifySignal
void NotifySignal (uv_work_t *r) {
v8::HandleScope scope;
async_req_signal *req = reinterpret_cast<async_req_signal *>(r->data);
v8::TryCatch try_catch;
v8::Local<v8::Value> argv[3];
// Create a new empty array.
v8::Local<v8::Array> array = v8::Array::New(req->params.size ());
// // Return an empty result if there was an error creating the array.
// if (array.IsEmpty())
// return Handle<Array>();
std::vector <std::string>::iterator it;
for (it = req->params.begin (); it != req->params.end (); it++)
array->Set(0, v8::String::New(it->c_str ()));
argv[0] = { v8::Local<v8::Value>::New(v8::String::New(req->quiddity_name.c_str ())) };
argv[1] = { v8::Local<v8::Value>::New(v8::String::New(req->signal_name.c_str ())) };
argv[2] = { v8::Local<v8::Value>::New(array)};
if (!user_signal_cb.IsEmpty ())
if (user_signal_cb->IsCallable ())
user_signal_cb->Call(user_signal_cb, 3, argv);
delete req;
if (try_catch.HasCaught()) {
node::FatalException(try_catch);
}
}
示例2: NotifyLog
void NotifyLog (uv_work_t *r) {
v8::HandleScope scope;
async_req_log *req = reinterpret_cast<async_req_log *>(r->data);
v8::TryCatch try_catch;
v8::Local<v8::Value> argv[] = { v8::Local<v8::Value>::New(v8::String::New(req->msg.c_str ())) };
if (!user_log_cb.IsEmpty ())
if (user_log_cb->IsCallable ())
user_log_cb->Call(user_log_cb, 1, argv);
delete req;
if (try_catch.HasCaught()) {
node::FatalException(try_catch);
}
}
示例3: NotifyProp
void NotifyProp (uv_work_t *r) {
v8::HandleScope scope;
async_req_prop *req = reinterpret_cast<async_req_prop *>(r->data);
v8::TryCatch try_catch;
v8::Local<v8::Value> argv[3];
argv[0] = { v8::Local<v8::Value>::New(v8::String::New(req->quiddity_name.c_str ())) };
argv[1] = { v8::Local<v8::Value>::New(v8::String::New(req->property_name.c_str ())) };
argv[2] = { v8::Local<v8::Value>::New(v8::String::New(req->value.c_str ())) };
if (!user_prop_cb.IsEmpty ())
if (user_prop_cb->IsCallable ())
user_prop_cb->Call(user_prop_cb, 3, argv);
delete req;
if (try_catch.HasCaught()) {
node::FatalException(try_catch);
}
}