Make sure all callbacks enqueue on the Node.js event loop (#1079)

Fixes #1077
This commit is contained in:
Yavor Georgiev 2017-06-19 13:19:43 +02:00 committed by GitHub
parent 3e80683ad8
commit acd962d602
4 changed files with 6 additions and 6 deletions

View File

@ -273,7 +273,7 @@ void ListClass<T>::add_listener(ContextType ctx, FunctionType, ObjectType this_o
ValueType arguments[2];
arguments[0] = static_cast<ObjectType>(protected_this);
arguments[1] = CollectionClass<T>::create_collection_change_set(protected_ctx, change_set);
Function<T>::call(protected_ctx, protected_callback, protected_this, 2, arguments);
Function<T>::callback(protected_ctx, protected_callback, protected_this, 2, arguments);
});
list->m_notification_tokens.emplace_back(protected_callback, std::move(token));
}

View File

@ -132,7 +132,7 @@ class RealmDelegate : public BindingContext {
std::list<Protected<FunctionType>> notifications_copy(m_notifications);
for (auto &callback : notifications_copy) {
Function<T>::call(m_context, callback, realm_object, 2, arguments);
Function<T>::callback(m_context, callback, realm_object, 2, arguments);
}
}
@ -603,7 +603,7 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, FunctionType,
ValueType callback_arguments[1];
callback_arguments[0] = object;
Function<T>::call(protected_ctx, protected_callback, protected_this, 1, callback_arguments);
Function<T>::callback(protected_ctx, protected_callback, protected_this, 1, callback_arguments);
return;
}
}
@ -611,7 +611,7 @@ void RealmClass<T>::wait_for_download_completion(ContextType ctx, FunctionType,
ValueType callback_arguments[1];
callback_arguments[0] = Value::from_null(ctx);
Function<T>::call(ctx, callback_function, this_object, 1, callback_arguments);
Function<T>::callback(ctx, callback_function, this_object, 1, callback_arguments);
}
template<typename T>

View File

@ -254,7 +254,7 @@ void ResultsClass<T>::add_listener(ContextType ctx, FunctionType, ObjectType thi
ValueType arguments[2];
arguments[0] = static_cast<ObjectType>(protected_this);
arguments[1] = CollectionClass<T>::create_collection_change_set(protected_ctx, change_set);
Function<T>::call(protected_ctx, protected_callback, protected_this, 2, arguments);
Function<T>::callback(protected_ctx, protected_callback, protected_this, 2, arguments);
});
results->m_notification_tokens.emplace_back(protected_callback, std::move(token));
}

View File

@ -234,7 +234,7 @@ public:
arguments[0] = create_object<T, SessionClass<T>>(m_ctx, new WeakSession(session));
arguments[1] = error_object;
Function<T>::call(m_ctx, m_func, 2, arguments);
Function<T>::callback(m_ctx, m_func, typename T::Object(), 2, arguments);
}
private:
const Protected<typename T::GlobalContext> m_ctx;