summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/event.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript/event.cpp')
-rw-r--r--fpdfsdk/javascript/event.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp
index f20ac40374..61aa546195 100644
--- a/fpdfsdk/javascript/event.cpp
+++ b/fpdfsdk/javascript/event.cpp
@@ -39,30 +39,11 @@ JSPropertySpec CJS_Event::PropertySpecs[] = {
const char* CJS_Event::g_pClassName = "event";
int CJS_Event::g_nObjDefnID = -1;
-void CJS_Event::JSConstructor(CFXJS_Engine* pEngine,
- v8::Local<v8::Object> obj) {
- CJS_Object* pObj = new CJS_Event(obj);
- pObj->SetEmbedObject(new event(pObj));
- pEngine->SetObjectPrivate(obj, pObj);
- pObj->InitInstance(static_cast<CJS_Runtime*>(pEngine));
-}
-
-void CJS_Event::JSDestructor(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj) {
- delete static_cast<CJS_Event*>(pEngine->GetObjectPrivate(obj));
-}
-
-void CJS_Event::DefineProps(CFXJS_Engine* pEngine) {
- for (size_t i = 0; i < FX_ArraySize(PropertySpecs) - 1; ++i) {
- pEngine->DefineObjProperty(g_nObjDefnID, PropertySpecs[i].pName,
- PropertySpecs[i].pPropGet,
- PropertySpecs[i].pPropPut);
- }
-}
-
void CJS_Event::DefineJSObjects(CFXJS_Engine* pEngine, FXJSOBJTYPE eObjType) {
g_nObjDefnID = pEngine->DefineObj(CJS_Event::g_pClassName, eObjType,
- JSConstructor, JSDestructor);
- DefineProps(pEngine);
+ JSConstructor<CJS_Event, event>,
+ JSDestructor<CJS_Event>);
+ DefineProps(pEngine, g_nObjDefnID, PropertySpecs);
}
event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {}