如何在 Native Client 中的 Vardictonary 中接收数组从 javascript 发送
How to receive array within Vardictonary in Native Client send from javascript
我正在将带有字符串和数组的字典从 javascript 发送到本机客户端,如
var paramdata=[] //with values
common.naclModule.postMessage({'message' : 'Configuration',
'param_array' : paramdata});
并尝试从本地客户端接收
if (var_message.is_dictionary()) {
pp::VarArray param_array;
pp::VarDictionary dictionary_js(var_message);
std::string js_message = dictionary_js.Get("message").AsString();
if(js_message == "Configuration")
{
pp::Var var(dictionary_js.Get("param_array"));
但它会给出类似 error: no match for call to `(pp::VarArray) (pp::Var&)' 的错误...什么是正确的方法从字典中获取数组。
提前致谢。
我得到了答案..我必须使用
pp::VarArray array = dictionary_js.Get("param_array");
而不是
pp::Var var(dictionary_js.Get("param_array"));
我正在将带有字符串和数组的字典从 javascript 发送到本机客户端,如
var paramdata=[] //with values
common.naclModule.postMessage({'message' : 'Configuration',
'param_array' : paramdata});
并尝试从本地客户端接收
if (var_message.is_dictionary()) {
pp::VarArray param_array;
pp::VarDictionary dictionary_js(var_message);
std::string js_message = dictionary_js.Get("message").AsString();
if(js_message == "Configuration")
{
pp::Var var(dictionary_js.Get("param_array"));
但它会给出类似 error: no match for call to `(pp::VarArray) (pp::Var&)' 的错误...什么是正确的方法从字典中获取数组。 提前致谢。
我得到了答案..我必须使用
pp::VarArray array = dictionary_js.Get("param_array");
而不是
pp::Var var(dictionary_js.Get("param_array"));