changeset 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 6ec4d7e90480
files nodejs/mbfly_njs.cc
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/mbfly_njs.cc	Sat Jun 05 22:29:22 2010 +0800
+++ b/nodejs/mbfly_njs.cc	Sun Jun 06 13:45:25 2010 +0800
@@ -3,9 +3,18 @@
 
 using namespace v8;
 
+Handle<Value>
+hello_func(const Arguments &args) {
+    HandleScope scope;
+
+    return String::Concat(String::New("World"), args[0]->ToString());
+}
+
 extern "C" void
 init(Handle<Object> target) {
     HandleScope scope;
+    Handle<FunctionTemplate> func;
 
-    target->Set(String::New("Hello"), String::New("World"));
+    func = FunctionTemplate::New(hello_func);
+    target->Set(String::New("Hello"), func->GetFunction());
 }