/// <summary> /// Remove all event handlers by its event type. /// </summary> /// <param name="eventType">The type of the event to remove. Possible values: put, update, delete. If not specified, it will remove all listeners of this reference.</param> /// <returns>This item reference.</returns> public ItemRef <T> Off(StorageEventType eventType) { _notifications[eventType][StorageNotificationType.ON].Clear(); _notifications[eventType][StorageNotificationType.ONCE].Clear(); _notifications[eventType][StorageNotificationType.DELETE].Clear(); return(this); }
/// <summary> /// Attach a listener to run only once the event type occurs. /// </summary> /// <param name="eventType">The type of the event to listen. Possible values: put, update, delete.</param> /// <param name="handler">The function invoked, only once, when the notification is received. If the event type is "put", it will immediately trigger a "getItems" to get the initial data and run the callback with each item snapshot as argument.</param> /// <param name="onError">Response if an error was returned from the server.</param> /// <returns>This item reference.</returns> public ItemRef <T> Once(StorageEventType eventType, Action <ItemSnapshot> handler, Action <StorageError> onError = null) { // TODO : Why ? // if (eventType == Storage.EventType.PUT) // this.Get(handler, onError); _notifications[eventType][StorageNotificationType.ONCE].Add(handler); Subscribe(); return(this); }
/// <summary> /// Remove a listener(s). /// </summary> /// <param name="eventType">The type of the event.</param> /// <returns>This table reference.</returns> public TableRef <T> Off(StorageEventType eventType) { Off(eventType, String.Empty); return(this); }
/// <summary> /// Remove a listener(s). /// </summary> /// <param name="eventType">The type of the event.</param> /// <param name="primaryKeyValue">The primary key of the item(s)</param> /// <returns>This table reference.</returns> public TableRef <T> Off(StorageEventType eventType, string primaryKeyValue) { return(this); }
/// <summary> /// Attach a listener to run only once when the eventType occurs. /// </summary> /// <typeparam name="T">The type of the item.</typeparam> /// <param name="eventType">The type of the event to listen for.</param> /// <param name="handler">The function invoked, only once, when the notification is received. If the event type is "put", it will immediately trigger a "getItems" to get the initial data and run the callback with each item snapshot as argument.</param> /// <returns>This table reference.</returns> public TableRef <T> Once(StorageEventType eventType, Action <ItemSnapshot> handler) { Once(eventType, String.Empty, handler); return(this); }
/// <summary> /// Attach a listener to run only once, when the eventType occurs on item(s) with the provided primary key. /// </summary> /// <typeparam name="T">The type of the item.</typeparam> /// <param name="eventType">The type of the event to listen for.</param> /// <param name="primaryKeyValue">The primary key of the item(s). When a change occurs to the item(s), the handler is called once.</param> /// <param name="handler">The function invoked, only once, when the notification is received. If the event type is "put", it will immediately trigger a "getItems" to get the initial data and run the callback with each item snapshot as argument.</param> /// <returns>This table reference.</returns> public TableRef <T> Once(StorageEventType eventType, string primaryKeyValue, Action <ItemSnapshot> handler) { _notifications[eventType][StorageNotificationType.ONCE].Add(handler); Subscribe(primaryKeyValue); return(this); }
public void RemoveEventListener(StorageEventType type, EventListener <StorageEvent <Window> > listener, bool useCapture = false) { }