Index: src/FilterEngine.cpp |
=================================================================== |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -340,7 +340,27 @@ |
return func->Call(params)->AsString(); |
} |
-void FilterEngine::ForceUpdateCheck(FilterEngine::UpdaterCallback callback) |
+void FilterEngine::SetUpdateAvailableCallback( |
+ FilterEngine::UpdateAvailableCallback callback) |
+{ |
+ jsEngine->SetEventCallback("updateAvailable", |
+ std::tr1::bind(&FilterEngine::UpdateAvailable, this, callback, |
+ std::tr1::placeholders::_1)); |
+} |
+ |
+void FilterEngine::RemoveUpdateAvailableCallback() |
+{ |
+ jsEngine->RemoveEventCallback("updateAvailable"); |
+} |
+ |
+void FilterEngine::UpdateAvailable( |
+ FilterEngine::UpdateAvailableCallback callback, JsValueList& params) |
+{ |
+ callback(params[0]->AsString()); |
Wladimir Palant
2014/09/18 19:44:17
I'd rather not crash if the JS code unexpectedly d
Felix Dahlke
2014/09/19 02:51:41
Knowing that the updater actually ensures a valid
|
+} |
+ |
+void FilterEngine::ForceUpdateCheck( |
+ FilterEngine::UpdateCheckDoneCallback callback) |
{ |
std::string eventName = "updateCheckDone"; |
eventName += ++updateCheckId; |
@@ -354,7 +374,8 @@ |
func->Call(params); |
} |
-void FilterEngine::UpdateCheckDone(const std::string& eventName, FilterEngine::UpdaterCallback callback, JsValueList& params) |
+void FilterEngine::UpdateCheckDone(const std::string& eventName, |
+ FilterEngine::UpdateCheckDoneCallback callback, JsValueList& params) |
{ |
jsEngine->RemoveEventCallback(eventName); |