i tryed to read some tests to embed a simple object instance in v8.
can somebody explain me why the log and logObj functions aren't defined in
this example?
int main(int argc, char* argv[]) {
>
> // Get the default Isolate created at startup.
>
> Isolate* isolate = Isolate::GetCurrent();
>
>
>> // Create a stack-allocated handle scope.
>
> HandleScope handle_scope(isolate);
>
>
>>
>
>
>
> // Create a new context.
>
> Handle<Context> context = Context::New(isolate);
>
>
>
>
>
> // Here's how you could create a Persistent handle to the context, if
>> needed.
>
> Persistent<Context> persistent_context(isolate, context);
>
>
>
>
>
> // Enter the created context for compiling and
>
> // running the hello world script.
>
> Context::Scope context_scope(context);
>
>
>
>
>
> // Create a string containing the JavaScript source code.
>
> Handle<String> source = String::New("'Hello' + ', World!' + log +
>> logObj.getUrl()");
>
>
>
> Handle<Object> proto = Object::New();
>
> proto->Set(String::New("log"), FunctionTemplate::New(LogCallback));
>
> proto->Set(String::New("logObj"), Request::newV8Instance());
>
>
>
> context->Global()->SetPrototype(proto);
>
>
>
> // Compile the source code.
>
> Handle<Script> script = Script::Compile(source);
>
> // Run the script to get the result.
>
> Handle<Value> result = script->Run();
>
>
>> // The persistent handle needs to be eventually disposed.
>
> persistent_context.Dispose();
>
>
>> // Convert the result to an ASCII string and print it.
>
> String::AsciiValue ascii(result);
>
> printf("%s\n", *ascii);
>
> return 0;
>
> }
>
>
seems to be up to the context, but i really dont know why log and logObj
arent found.
--
--
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/groups/opt_out.