Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
[enhancement] Added ability to unregister listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna5ama committed Dec 22, 2020
1 parent f808f67 commit af45f7b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions org/kamiblue/event/ListenerManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ object ListenerManager {
asyncListenerMap.getOrPut(`object`, ::CopyOnWriteArrayList).add(asyncListener)
}

/**
* Unregister all listeners of this object, this can not be undone
*/
fun unregister(`object`: Any) {
listenerMap.remove(`object`)
asyncListenerMap.remove(`object`)
}

/**
* Get all registered listeners of this [object]
*
Expand Down

0 comments on commit af45f7b

Please sign in to comment.