# HG changeset patch # User Thinker K.F. Li # Date 1275803125 -28800 # Node ID f69b0814ef3c11666bc1a6ef46424e7e8a1d4dd5 # Parent 371690a166df84a2b653d926c1e318bb869d31a9 Test FunctionTemplate diff -r 371690a166df -r f69b0814ef3c nodejs/mbfly_njs.cc --- 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 +hello_func(const Arguments &args) { + HandleScope scope; + + return String::Concat(String::New("World"), args[0]->ToString()); +} + extern "C" void init(Handle target) { HandleScope scope; + Handle func; - target->Set(String::New("Hello"), String::New("World")); + func = FunctionTemplate::New(hello_func); + target->Set(String::New("Hello"), func->GetFunction()); }