Skip to content

Add throttle operator#108

Closed
DevYeom wants to merge 1 commit intomainfrom
throttle
Closed

Add throttle operator#108
DevYeom wants to merge 1 commit intomainfrom
throttle

Conversation

@DevYeom
Copy link
Owner

@DevYeom DevYeom commented Oct 19, 2025

Related Issues 💭

Description 📝

  • Add a new operator that emits elements from this effect, but only if a certain amount of time has passed between emissions.

Additional Notes 📚

enum ThrottleID {
    case button
}

func reduce(state: inout State, action: Action) -> AnyEffect<Action> {
    switch action {
    // ...
    case .perform:
        return .just(.increment)
            .throttle(id: ThrottleID.button, for: 1.0, latest: true)
    // ...
    }
}

Checklist ✅

  • If it's a new feature, have appropriate unit tests been added?
  • If the changes affect existing functionality, please verify whether the above information has been appropriately described.

@DevYeom DevYeom self-assigned this Oct 19, 2025
@DevYeom DevYeom force-pushed the throttle branch 11 times, most recently from 3231b0c to 8e18242 Compare October 19, 2025 08:01
@DevYeom DevYeom marked this pull request as draft October 19, 2025 08:06
@DevYeom DevYeom force-pushed the throttle branch 3 times, most recently from 3cf2721 to 3915e19 Compare October 19, 2025 08:35
@DevYeom DevYeom closed this Oct 19, 2025
@DevYeom DevYeom deleted the throttle branch November 2, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments