mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-20 04:11:34 +02:00
Activates updates
This commit is contained in:
@@ -57,9 +57,9 @@ class BundledInsert<T>(
|
|||||||
private var atomicSet = AtomicReference<Set<T>>(setOf<T>())
|
private var atomicSet = AtomicReference<Set<T>>(setOf<T>())
|
||||||
|
|
||||||
fun invalidateList(newObject: T, onUpdate: (Set<T>) -> Unit) {
|
fun invalidateList(newObject: T, onUpdate: (Set<T>) -> Unit) {
|
||||||
// atomicSet.updateAndGet() {
|
atomicSet.updateAndGet() {
|
||||||
// it + newObject
|
it + newObject
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (onlyOneInBlock.getAndSet(true)) {
|
if (onlyOneInBlock.getAndSet(true)) {
|
||||||
return
|
return
|
||||||
@@ -68,10 +68,9 @@ class BundledInsert<T>(
|
|||||||
val scope = CoroutineScope(Job() + dispatcher)
|
val scope = CoroutineScope(Job() + dispatcher)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
try {
|
try {
|
||||||
// onUpdate(atomicSet.getAndSet(emptySet()))
|
onUpdate(atomicSet.getAndSet(emptySet()))
|
||||||
onUpdate(emptySet())
|
|
||||||
delay(delay)
|
delay(delay)
|
||||||
// onUpdate(atomicSet.getAndSet(emptySet()))
|
onUpdate(atomicSet.getAndSet(emptySet()))
|
||||||
} finally {
|
} finally {
|
||||||
withContext(NonCancellable) {
|
withContext(NonCancellable) {
|
||||||
onlyOneInBlock.set(false)
|
onlyOneInBlock.set(false)
|
||||||
|
Reference in New Issue
Block a user