diff options
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/fxjs_v8.cpp | 10 | ||||
-rw-r--r-- | fxjs/fxjs_v8.h | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp index a5eba1bbc1..dc2071a88f 100644 --- a/fxjs/fxjs_v8.cpp +++ b/fxjs/fxjs_v8.cpp @@ -270,18 +270,17 @@ int CFXJS_Engine::DefineObj(const char* sObjName, } void CFXJS_Engine::DefineObjMethod(int nObjDefnID, - const wchar_t* sMethodName, + const char* sMethodName, v8::FunctionCallback pMethodCall) { v8::Isolate::Scope isolate_scope(m_isolate); v8::HandleScope handle_scope(m_isolate); - CFX_ByteString bsMethodName = FX_UTF8Encode(CFX_WideStringC(sMethodName)); CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(m_isolate, nObjDefnID); v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New( m_isolate, pMethodCall, v8::Local<v8::Value>(), pObjDef->GetSignature()); fun->RemovePrototype(); pObjDef->GetInstanceTemplate()->Set( - v8::String::NewFromUtf8(m_isolate, bsMethodName.c_str(), + v8::String::NewFromUtf8(m_isolate, sMethodName, v8::NewStringType::kNormal) .ToLocalChecked(), fun, v8::ReadOnly); @@ -328,16 +327,15 @@ void CFXJS_Engine::DefineObjConst(int nObjDefnID, pObjDef->GetInstanceTemplate()->Set(m_isolate, bsConstName.c_str(), pDefault); } -void CFXJS_Engine::DefineGlobalMethod(const wchar_t* sMethodName, +void CFXJS_Engine::DefineGlobalMethod(const char* sMethodName, v8::FunctionCallback pMethodCall) { v8::Isolate::Scope isolate_scope(m_isolate); v8::HandleScope handle_scope(m_isolate); - CFX_ByteString bsMethodName = FX_UTF8Encode(CFX_WideStringC(sMethodName)); v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(m_isolate, pMethodCall); fun->RemovePrototype(); GetGlobalObjectTemplate(m_isolate)->Set( - v8::String::NewFromUtf8(m_isolate, bsMethodName.c_str(), + v8::String::NewFromUtf8(m_isolate, sMethodName, v8::NewStringType::kNormal) .ToLocalChecked(), fun, v8::ReadOnly); diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h index 541566f6d0..6b988e71a2 100644 --- a/fxjs/fxjs_v8.h +++ b/fxjs/fxjs_v8.h @@ -148,7 +148,7 @@ class CFXJS_Engine { Destructor pDestructor); void DefineObjMethod(int nObjDefnID, - const wchar_t* sMethodName, + const char* sMethodName, v8::FunctionCallback pMethodCall); void DefineObjProperty(int nObjDefnID, const wchar_t* sPropName, @@ -162,7 +162,7 @@ class CFXJS_Engine { void DefineObjConst(int nObjDefnID, const wchar_t* sConstName, v8::Local<v8::Value> pDefault); - void DefineGlobalMethod(const wchar_t* sMethodName, + void DefineGlobalMethod(const char* sMethodName, v8::FunctionCallback pMethodCall); void DefineGlobalConst(const wchar_t* sConstName, v8::FunctionCallback pConstGetter); |