refs #72: clarity around bg/fg functions

This commit is contained in:
Justin R. Miller
2014-02-19 12:45:05 -08:00
parent cfbb8e9f7d
commit 0f2beb6992

View File

@@ -226,7 +226,7 @@ void restart(void *) {
mapView->dirty = true;
}
void request_http(std::string url, std::function<void(Response&)> func, std::function<void()> cb) {
void request_http(std::string url, std::function<void(Response&)> background_function, std::function<void()> foreground_callback) {
if (!queue) {
queue = [NSOperationQueue new];
}
@@ -246,9 +246,9 @@ void request_http(std::string url, std::function<void(Response&)> func, std::fun
res.body = { (const char *)[data bytes], [data length] };
}
func(res);
background_function(res);
dispatch_async(dispatch_get_main_queue(), ^(void) {
cb();
foreground_callback();
});
[[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil];
}];