Index: src/JsEngine.cpp |
=================================================================== |
--- a/src/JsEngine.cpp |
+++ b/src/JsEngine.cpp |
@@ -114,6 +114,11 @@ |
// TODO: Move the rest of the global object initializations here |
} |
+JsEngineInternal& AdblockPlus::JsEngine::Internal() |
+{ |
+ return *static_cast<JsEngineInternal*>(this); |
+} |
+ |
/** |
* \par Design Notes |
* It is technically necessary to construct JsEngine instances *only* within a factory. |
@@ -201,21 +206,19 @@ |
} |
void AdblockPlus::JsEngine::SetEventCallback(const std::string& eventName, |
- AdblockPlus::JsEngine::EventCallback callback) |
+ AdblockPlus::JsEngine::EventCallback callback) |
{ |
- eventCallbacks[eventName] = callback; |
+ Internal().eventMan.Set(eventName, callback); |
} |
void AdblockPlus::JsEngine::RemoveEventCallback(const std::string& eventName) |
{ |
- eventCallbacks.erase(eventName); |
+ Internal().eventMan.Remove(eventName); |
} |
void AdblockPlus::JsEngine::TriggerEvent(const std::string& eventName, AdblockPlus::JsValueList& params) |
{ |
- EventMap::iterator it = eventCallbacks.find(eventName); |
- if (it != eventCallbacks.end()) |
- it->second(params); |
+ Internal().eventMan.Trigger(eventName, params); |
} |
void AdblockPlus::JsEngine::Gc() |