Mercurial > MadButterfly
comparison nodejs/mbfly_njs.cc @ 548:f69b0814ef3c Android_Skia
Test FunctionTemplate
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 06 Jun 2010 13:45:25 +0800 |
parents | 371690a166df |
children | c9d23f7279a4 |
comparison
equal
deleted
inserted
replaced
547:371690a166df | 548:f69b0814ef3c |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include <v8.h> | 2 #include <v8.h> |
3 | 3 |
4 using namespace v8; | 4 using namespace v8; |
5 | 5 |
6 Handle<Value> | |
7 hello_func(const Arguments &args) { | |
8 HandleScope scope; | |
9 | |
10 return String::Concat(String::New("World"), args[0]->ToString()); | |
11 } | |
12 | |
6 extern "C" void | 13 extern "C" void |
7 init(Handle<Object> target) { | 14 init(Handle<Object> target) { |
8 HandleScope scope; | 15 HandleScope scope; |
16 Handle<FunctionTemplate> func; | |
9 | 17 |
10 target->Set(String::New("Hello"), String::New("World")); | 18 func = FunctionTemplate::New(hello_func); |
19 target->Set(String::New("Hello"), func->GetFunction()); | |
11 } | 20 } |