mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 13:47:47 +02:00
fix(core/event_dispatcher): cache concurrent calls
This commit is contained in:
@ -28,9 +28,11 @@ class EventDispatcher(
|
||||
context.mappings.useMapper(ViewBinderMapper::class) {
|
||||
val cachedHooks = mutableListOf<String>()
|
||||
fun cacheHook(clazz: Class<*>, block: Class<*>.() -> Unit) {
|
||||
if (!cachedHooks.contains(clazz.name)) {
|
||||
clazz.block()
|
||||
cachedHooks.add(clazz.name)
|
||||
synchronized(cachedHooks) {
|
||||
if (!cachedHooks.contains(clazz.name)) {
|
||||
clazz.block()
|
||||
cachedHooks.add(clazz.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user