From 235b8b257b5e628f02244fe5dfe93369199f5700 Mon Sep 17 00:00:00 2001 From: neuecc Date: Sat, 2 Mar 2024 18:03:49 +0900 Subject: [PATCH] about sample timing --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 422202b4..907ae80b 100644 --- a/README.md +++ b/README.md @@ -569,6 +569,12 @@ Additionally, the following time-related filtering/aggregating methods can also | **ThrottleFirst**(this `Observable` source, `Func` sampler, `Boolean` configureAwait = true) | `Observable` | | **ThrottleLast**(this `Observable` source, `Func` sampler, `Boolean` configureAwait = true) | `Observable` | | **ThrottleFirstLast**(this `Observable` source, `Func` sampler, `Boolean` configureAwait = true) | `Observable` | +| **SkipUntil**(this `Observable` source, `CancellationToken` cancellationToken) | `Observable` | +| **SkipUntil**(this `Observable` source, `Task` task) | `Observable` | +| **SkipUntil**(this `Observable` source, `Func` asyncFunc, `Boolean` configureAwait = true) | `Observable` | +| **TakeUntil**(this `Observable` source, `CancellationToken` cancellationToken) | `Observable` | +| **TakeUntil**(this `Observable` source, `Task` task) | `Observable` | +| **TakeUntil**(this `Observable` source, `Func` asyncFunc, `Boolean` configureAwait = true) | `Observable` | | **Chunk**(this `Observable` source, `Func` asyncWindow, `Boolean` configureAwait = true) | `Observable` | For example, by using the asynchronous function version of Chunk, you can naturally and easily write complex processes such as generating chunks at random times instead of fixed times. @@ -642,6 +648,16 @@ This means that the issuance of OnNext must always be done on a single thread. A For converting external inputs into Observables, such as with FromEvent, and when the source of input issues in a multi-threaded manner, it is necessary to synchronize using `Synchronize` to construct the correct operator chain. +Sampling Timing +--- +The `Sample(TimeSpan)` in dotnet/reactive starts a timer in the background when subscribed to, and uses that interval for filtering. Additionally, the timer continues to run in the background indefinitely. + +`ThrottleFirst/Last/FirstLast(TimeSpan)` in R3 behaves differently; the timer is stopped upon subscription and only starts when a value arrives. If the timer is stopped at that time, it starts, and then stops the timer after the specified duration. + +Also, overloads that accept an asynchronous function `Func`, such as `ThrottleFirst/Last/FirstLast`, `Chunk`, `SkipUntil`, `TakeUntil`), behave in such a way that if the asynchronous function is not running when a value arrives, the execution of the asynchronous function begins. + +This change is expected to result in consistent behavior across all operators. + ObservableCollections --- As a special collection for monitoring changes in collections and handling them in R3, the [ObservableCollections](https://github.com/Cysharp/ObservableCollections)'s `ObservableCollections.R3` package is available.