Skip to content

Removing Listeners

Listener objects can be removed when the application is no longer interested in receiving real-time updates. A listener (or all of them) should be removed from the same event handler object which they were added to. The following listener removal APIs are available:

Removing all listeners

The method removes all registered listeners for the create event:

eventHandler.removeCreateListeners();

The method below removes all listeners which process events for a specific where clause. The value of the whereClause argument must be the same as one in the addCreateListener method:

eventHandler.removeCreateListeners( String whereClause );

Removing a specific listener

This method removes a listener identified by a callback object:

// for the class-based approach;
eventHandler.removeCreateListener( AsyncCallback<T> listenerObject );

// for the map-based approach:
eventHandler.removeCreateListener( AsyncCallback<Map> listenerObject );

Codeless Reference

rt_database_remove_listener_1

where:

Argument                Description
id Unique identifier of the event listener that must be deleted.

This operation does not return a value.

The example below registers a new create listener with the id``"1EFD-3GEF2-FF4C-AC21" , waits for 15000 milliseconds and deletes the event listener.

rt_remove_create_listener_1