File tree Expand file tree Collapse file tree 1 file changed +1
-11
lines changed
hooks/src/main/kotlin/xyz/junerver/compose/hooks/userequest/plugins Expand file tree Collapse file tree 1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change @@ -58,16 +58,6 @@ class PollingPlugin<TData : Any> : Plugin<TData>() {
58
58
}
59
59
val pluginScope = this
60
60
61
- // 替换run函数为循环执行
62
- // fetch.run = {
63
- // scope.launch {
64
- // while (isActive) {
65
- // fetch._run(it)
66
- // delay(pollingInterval)
67
- // }
68
- // }.also { pollingJob = it }
69
- // }
70
-
71
61
object : PluginLifecycle <TData >() {
72
62
override val onBefore: ((TParams ) -> OnBeforeReturn <TData >? )
73
63
get() = {
@@ -91,7 +81,7 @@ class PollingPlugin<TData : Any> : Plugin<TData>() {
91
81
if (pollingErrorRetryCount == - 1 || count <= pollingErrorRetryCount) {
92
82
usedScope.launch(Dispatchers .IO ) {
93
83
delay(pollingInterval)
94
- fetch.refreshAsync()
84
+ if (pollingWhenHidden) fetch.refreshAsync() else fetch.refresh ()
95
85
}.also { pollingJob = it }
96
86
} else {
97
87
count = 0
You can’t perform that action at this time.
0 commit comments