Mercurial > MadButterfly
annotate nodejs/observer.cc @ 788:7ec13634c97d
Add holder for animate
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 31 Aug 2010 02:36:01 +0800 |
parents | 32e1b8005403 |
children | 586e50f82c1f |
rev | line source |
---|---|
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 #include <v8.h> |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 #include "mbfly_njs.h" |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 extern "C" { |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 #include <mb.h> |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 #include <string.h> |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 } |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 #ifndef ASSERT |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 #define ASSERT(x) |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 #endif |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 using namespace v8; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 |
686 | 15 /*! \defgroup xnjsmb_observer JS binding for observer, subject and events |
16 * \ingroup xnjsmb | |
17 * | |
18 * @{ | |
19 */ | |
20 | |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 struct xnjsmb_observer_data { |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 Persistent<Function> func; |
698
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
23 Persistent<Context> ctx; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 }; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
26 static void |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 event_handler(event_t *evt, void *arg); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 |
679
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
29 static void |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
30 xnjsmb_event_mod(Handle<Object> self, event_t *evt) { |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
31 mouse_event_t *mevt; |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
32 X_kb_event_t *xkbevt; |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
33 |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
34 switch(evt->type) { |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
35 case EVT_ANY: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
36 case EVT_MOUSE_OVER: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
37 case EVT_MOUSE_OUT: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
38 case EVT_MOUSE_MOVE: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
39 case EVT_MOUSE_BUT_PRESS: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
40 case EVT_MOUSE_BUT_RELEASE: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
41 mevt = (mouse_event_t *)evt; |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
42 SET(self, "x", Integer::New(mevt->x)); |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
43 SET(self, "y", Integer::New(mevt->y)); |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
44 SET(self, "but_state", Integer::New(mevt->but_state)); |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
45 SET(self, "button", Integer::New(mevt->button)); |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
46 break; |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
47 |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
48 case EVT_KB_PRESS: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
49 case EVT_KB_RELEASE: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
50 xkbevt = (X_kb_event_t *)evt; |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
51 SET(self, "keycode", Integer::New(xkbevt->keycode)); |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
52 SET(self, "sym", Integer::New(xkbevt->sym)); |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
53 break; |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
54 |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
55 case EVT_PROGM_COMPLETE: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
56 case EVT_RDMAN_REDRAW: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
57 case EVT_MONITOR_ADD: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
58 case EVT_MONITOR_REMOVE: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
59 case EVT_MONITOR_FREE: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
60 case EVT_MOUSE_MOVE_RAW: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
61 default: |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
62 /* Not implemented. Do nothing. */ |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
63 break; |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
64 } |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
65 } |
799c852b9065
Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
66 |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
67 static observer_t * |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
68 _subject_add_event_observer(subject_t *subject, int type, |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
69 Handle<Function> func) { |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
70 observer_t *observer; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
71 xnjsmb_observer_data *data; |
698
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
72 Handle<Context> ctx; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
73 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
74 data = new xnjsmb_observer_data; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
75 if(data == NULL) |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
76 return NULL; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
77 data->func = Persistent<Function>::New(func); |
698
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
78 ctx = Context::GetCurrent(); |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
79 data->ctx = Persistent<Context>::New(ctx); |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
80 observer = subject_add_event_observer(subject, type, |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
81 event_handler, |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
82 data); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
83 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
84 return observer; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
85 } |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
86 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
87 static void |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
88 _subject_remove_observer(subject_t *subject, observer_t *observer) { |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
89 xnjsmb_observer_data *data; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
90 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
91 subject_remove_observer(subject, observer); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
92 data = (xnjsmb_observer_data *)observer->arg; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
93 delete data; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
94 } |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
95 |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
96 static Handle<Value> |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
97 xnjsmb_event_tgt_getter(Handle<Object> self, event_t *evt, const char **err) { |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
98 Persistent<Object> *hdl; |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
99 |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
100 hdl = (Persistent<Object> *) |
788
7ec13634c97d
Add holder for animate
Thinker K.F. Li <thinker@codemud.net>
parents:
698
diff
changeset
|
101 mb_prop_get(&((mb_obj_t *)evt->tgt->obj)->props, |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
102 PROP_JSOBJ); |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
103 return Local<Object>::New(*hdl); |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
104 } |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
105 |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
106 static void |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
107 xnjsmb_event_tgt_setter(Handle<Object> self, event_t *evt, |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
108 Handle<Value> value, const char **err) { |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
109 *err = "Not implemented"; |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
110 } |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
111 |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
112 static Handle<Value> |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
113 xnjsmb_event_cur_tgt_getter(Handle<Object> self, event_t *evt, |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
114 const char **err) { |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
115 Persistent<Object> *hdl; |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
116 |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
117 hdl = (Persistent<Object> *) |
788
7ec13634c97d
Add holder for animate
Thinker K.F. Li <thinker@codemud.net>
parents:
698
diff
changeset
|
118 mb_prop_get(&((mb_obj_t *)evt->cur_tgt->obj)->props, |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
119 PROP_JSOBJ); |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
120 return Local<Object>::New(*hdl); |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
121 } |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
122 |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
123 static void |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
124 xnjsmb_event_cur_tgt_setter(Handle<Object> self, event_t *evt, |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
125 Handle<Value> value, const char **err) { |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
126 *err = "Not implemented"; |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
127 } |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
128 |
655 | 129 /* This is the part of the code generated by gen_v8_binding.m4 */ |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
130 #include "observer-inc.h" |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
131 |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
132 static void |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
133 event_handler(event_t *evt, void *arg) { |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
134 xnjsmb_observer_data *data = (xnjsmb_observer_data *)arg; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
135 Handle<Value> evt_obj; |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
136 Handle<Value> func_args[1]; |
698
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
137 Handle<Value> r; |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
138 Context::Scope context_scope(data->ctx); |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
139 TryCatch trycatch; |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
140 |
656
38c720272dd5
Change prefix for the code generated by generator
Thinker K.F. Li <thinker@branda.to>
parents:
655
diff
changeset
|
141 evt_obj = xnjsmb_auto_event_new(evt); |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
142 ASSERT(!evt_obj.IsEmpty()); |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
143 func_args[0] = evt_obj; |
698
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
144 r = data->func->Call(data->ctx->Global(), 1, func_args); |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
145 if(r.IsEmpty()) { |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
146 Handle<Value> exception = trycatch.Exception(); |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
147 String::AsciiValue exc_str(exception); |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
148 fprintf(stderr, "Exception: %s\n", *exc_str); |
32e1b8005403
Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents:
686
diff
changeset
|
149 } |
651
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
150 } |
aa52883534fc
Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
151 |
676
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
152 Handle<Value> |
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
153 export_xnjsmb_auto_subject_new(subject_t *subject) { |
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
154 Handle<Value> val; |
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
155 |
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
156 val = xnjsmb_auto_subject_new(subject); |
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
157 return val; |
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
158 } |
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
159 |
658
62c2de99b03a
Remove get_object() method for subject for js
Thinker K.F. Li <thinker@branda.to>
parents:
656
diff
changeset
|
160 void |
62c2de99b03a
Remove get_object() method for subject for js
Thinker K.F. Li <thinker@branda.to>
parents:
656
diff
changeset
|
161 xnjsmb_observer_init(void) { |
671
fc29a343ce7c
Track JS object with property store of objects
Thinker K.F. Li <thinker@branda.to>
parents:
658
diff
changeset
|
162 xnjsmb_auto_observer_init(); |
fc29a343ce7c
Track JS object with property store of objects
Thinker K.F. Li <thinker@branda.to>
parents:
658
diff
changeset
|
163 xnjsmb_auto_subject_init(); |
fc29a343ce7c
Track JS object with property store of objects
Thinker K.F. Li <thinker@branda.to>
parents:
658
diff
changeset
|
164 xnjsmb_auto_event_init(); |
658
62c2de99b03a
Remove get_object() method for subject for js
Thinker K.F. Li <thinker@branda.to>
parents:
656
diff
changeset
|
165 } |
686 | 166 |
167 /* @} */ |