mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 06:46:03 +00:00
implement list notification removal
This commit is contained in:
parent
555718bf86
commit
b1db10e177
@ -273,6 +273,7 @@ void ListClass<T>::remove_listener(ContextType ctx, ObjectType this_object, size
|
||||
|
||||
auto list = get_internal<T, ListClass<T>>(this_object);
|
||||
auto callback = Value::validated_to_function(ctx, arguments[0]);
|
||||
list->m_notification_tokens.erase(Protected<FunctionType>(ctx, callback));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -280,6 +281,7 @@ void ListClass<T>::remove_all_listeners(ContextType ctx, ObjectType this_object,
|
||||
validate_argument_count(argc, 0);
|
||||
|
||||
auto list = get_internal<T, ListClass<T>>(this_object);
|
||||
list->m_notification_tokens.clear();
|
||||
}
|
||||
|
||||
} // js
|
||||
|
@ -247,12 +247,12 @@ class Protected {
|
||||
bool operator!=(const ValueType &) const;
|
||||
bool operator==(const Protected<ValueType> &) const;
|
||||
bool operator!=(const Protected<ValueType> &) const;
|
||||
|
||||
|
||||
struct Comparator {
|
||||
bool operator()(const Protected<ValueType>& a, const Protected<ValueType>& b) const;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct Exception : public std::runtime_error {
|
||||
using ContextType = typename T::Context;
|
||||
@ -292,7 +292,7 @@ struct ReturnValue {
|
||||
void set_null();
|
||||
void set_undefined();
|
||||
};
|
||||
|
||||
|
||||
template<typename T, typename ClassType>
|
||||
REALM_JS_INLINE typename T::Object create_object(typename T::Context ctx, typename ClassType::Internal* internal = nullptr) {
|
||||
return Object<T>::template create_instance<ClassType>(ctx, internal);
|
||||
|
Loading…
x
Reference in New Issue
Block a user