Commit bc53bb0
authored
Add advanced observable extension methods (#112)
* Add advanced observable extension methods
Introduces multiple new extension methods for IObservable<T>, including buffering until idle, conditional scheduler switching, error logging, retry strategies, property observables, throttling, debouncing, async mapping, pairwise emission, and busy-dropping. These additions enhance reactive programming capabilities and provide more flexible stream manipulation options.
* Add and expand tests for new ReactiveExtensions methods
Added comprehensive unit tests for new extension methods in ReactiveExtensions, including ThrottleFirst, BufferUntilIdle, DropIfBusy, Pairwise, ScanWithInitial, SampleLatest, SwitchIfEmpty, ThrottleDistinct, ToReadOnlyBehavior, ToHotTask, and ToPropertyObservable. Also refactored the Pairwise implementation to use Zip for improved clarity and correctness.
* Enable and improve SubscribeSynchronous tests
Removed Ignore attributes from SubscribeSynchronous tests and improved completion waiting logic for reliability. Also fixed SynchronizeSynchronous to correctly forward OnError and OnCompleted events to observers.
* Update README with new operators and usage examples
Added documentation and examples for new operators: ThrottleDistinct, ToHotTask, SampleLatest, SwitchIfEmpty, DropIfBusy, BufferUntilIdle, Pairwise, ScanWithInitial, ToReadOnlyBehavior, and ToPropertyObservable. Updated operator tables and changelog to reflect these additions and fixed SynchronizeSynchronous documentation.
* Update README.md
* Add ObserveOnIf overloads for reactive conditions
Introduces new ObserveOnIf extension methods that accept IObservable<bool> as the condition, allowing dynamic switching of schedulers based on reactive conditions. Corresponding unit tests have been added to verify the new overloads' behavior.
* Refactor BufferUntilIdle test to use TestScheduler
Replaces Thread.Sleep with TestScheduler in BufferUntilIdle_BuffersUntilIdle test for more reliable and deterministic timing. Also adds missing ReactiveUI.Extensions using directive and minor docstring corrections.
* Add scheduler support to BufferUntilIdle extension
The BufferUntilIdle extension method now accepts an optional IScheduler parameter, allowing callers to specify the scheduler used for idle timeouts. This provides greater control over timing and thread context, improving flexibility for different reactive scenarios.
* Refactor DropIfBusy test to use TaskCompletionSource
Replaces Task.Delay with TaskCompletionSource in DropIfBusy_DropsWhenBusy test for more deterministic async control. This change improves test reliability by explicitly controlling when the async action completes.
* Add tests for ReplayLastOnSubscribe and DebounceUntil
Introduces unit tests for the ReplayLastOnSubscribe and DebounceUntil extension methods, verifying correct replay and debounce behavior. Also simplifies error handler signatures in existing OnErrorRetry tests.
* Add scheduler overload to ThrottleDistinct extension
Introduced a new ThrottleDistinct overload that accepts an IScheduler parameter, allowing for more precise control in reactive scenarios. Updated the corresponding unit test to use TestScheduler instead of Thread.Sleep for improved test reliability.1 parent 5214ef2 commit bc53bb0
File tree
3 files changed
+896
-95
lines changed- src
- ReactiveUI.Extensions.Tests
- ReactiveUI.Extensions
3 files changed
+896
-95
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
| |||
201 | 205 | | |
202 | 206 | | |
203 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
204 | 213 | | |
205 | 214 | | |
206 | 215 | | |
| |||
217 | 226 | | |
218 | 227 | | |
219 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
220 | 243 | | |
221 | 244 | | |
222 | 245 | | |
| |||
228 | 251 | | |
229 | 252 | | |
230 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
231 | 266 | | |
232 | 267 | | |
233 | 268 | | |
| |||
259 | 294 | | |
260 | 295 | | |
261 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
262 | 317 | | |
263 | 318 | | |
264 | 319 | | |
| |||
287 | 342 | | |
288 | 343 | | |
289 | 344 | | |
290 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
291 | 350 | | |
292 | 351 | | |
293 | 352 | | |
| |||
0 commit comments