Mercurial > MadButterfly
annotate 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 |
rev | line source |
---|---|
546
249bcbf07eb0
Reuse and adapt X_supp.c by implmeneting X_supp_njs.c
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 #include <stdio.h> |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
2 #include <v8.h> |
546
249bcbf07eb0
Reuse and adapt X_supp.c by implmeneting X_supp_njs.c
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
4 using namespace v8; |
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
5 |
548 | 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 | |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
13 extern "C" void |
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
14 init(Handle<Object> target) { |
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
15 HandleScope scope; |
548 | 16 Handle<FunctionTemplate> func; |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
17 |
548 | 18 func = FunctionTemplate::New(hello_func); |
19 target->Set(String::New("Hello"), func->GetFunction()); | |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
20 } |