开发者

how to send string data into a javascript?

I am using v8 and i faced next problem - i have an application which running a javascript file ( i simply read it into a strin开发者_开发问答g and than execute with

Local<String> source = String::New(javascript); //javascript is string with js file    
Local<Script> script = Script::Compile(source); 
Local<Value> result = script->Run();

how can I send a string variable into this file?


you can try prepending the necessary javascript statements onto your javascript code before you stringify and compile. Another option is to use an accessor which you assign to the context and will tie back to read/write methods in your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜