@tokamakdev/platform-android-arm64 0.1.1-beta.131 → 0.1.1-beta.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import kotlinx.coroutines.CoroutineScope
8
8
  import kotlinx.coroutines.CoroutineStart
9
9
  import kotlinx.coroutines.Job
10
10
  import kotlinx.coroutines.asCoroutineDispatcher
11
- import kotlinx.coroutines.channels.BufferOverflow
11
+ import kotlinx.coroutines.channels.Channel
12
12
  import kotlinx.coroutines.flow.Flow
13
13
  import kotlinx.coroutines.flow.MutableSharedFlow
14
14
  import kotlinx.coroutines.flow.onSubscription
@@ -64,16 +64,17 @@ class TokamakExporter<P : TokamakPlugin> internal constructor() {
64
64
  }
65
65
  }
66
66
 
67
- /** How many values listeners keep: those a slow reader has not taken, or those held for the first. */
68
- private const val LISTENER_CAPACITY = 64
67
+ /** How many values wait for the first listener. */
68
+ private const val HELD_CAPACITY = 64
69
69
 
70
70
  /**
71
71
  * The flows of an event's listeners, such as a page's, each of which receives every value [send]
72
- * delivers while it collects, keeping the newest 64 that a slow one has not taken. When [holding],
73
- * the newest 64 values sent while none listen wait for the first listener.
72
+ * delivers while it collects. A flow keeps every value its collector has not taken, so a Worker's
73
+ * subscription applies its own overflow policy. When [holding], the newest 64 values sent while
74
+ * none listen wait for the first listener.
74
75
  */
75
76
  class TokamakListeners<T>(private val holding: Boolean = false) {
76
- private val values = MutableSharedFlow<T>(extraBufferCapacity = LISTENER_CAPACITY, onBufferOverflow = BufferOverflow.DROP_OLDEST)
77
+ private val values = MutableSharedFlow<T>(extraBufferCapacity = Channel.UNLIMITED)
77
78
  private val held = mutableListOf<T>()
78
79
 
79
80
  /** A new listener's flow. */
@@ -86,7 +87,7 @@ class TokamakListeners<T>(private val holding: Boolean = false) {
86
87
  synchronized(held) {
87
88
  if (holding && values.subscriptionCount.value == 0) {
88
89
  held += value
89
- if (held.size > LISTENER_CAPACITY) held.removeAt(0)
90
+ if (held.size > HELD_CAPACITY) held.removeAt(0)
90
91
  return
91
92
  }
92
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokamakdev/platform-android-arm64",
3
- "version": "0.1.1-beta.131",
3
+ "version": "0.1.1-beta.132",
4
4
  "description": "The tokamak platform pack for android-arm64",
5
5
  "repository": {
6
6
  "type": "git",