Make sure all callbacks enqueue on the Node.js event loop (#1079)
Fixes #1077
This commit is contained in:
parent
3e80683ad8
commit
acd962d602
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue