Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator BufferTime #62

Open
Joel-PeakMetrics opened this issue Jul 2, 2023 · 3 comments
Open

Operator BufferTime #62

Joel-PeakMetrics opened this issue Jul 2, 2023 · 3 comments

Comments

@Joel-PeakMetrics
Copy link

Hello,

I'm looking to use Evt with my production codebase. The limited number of available operators could be a blocker for adoption. Could you please help me understand how hard it would be to add some of the available RxJS operators?

Here is one I'd like to have:
https://www.learnrxjs.io/learn-rxjs/operators/transformation/buffertime

If it is fairly easy to implement these operators using Evt, maybe we can continue our plan to use Evt in production.

TYIA!

@garronej
Copy link
Owner

garronej commented Jul 2, 2023

Hello @Joel-PeakMetrics,

Thank you for getting in touch.

Regrettably, in the current iteration of EVT, operators do not have the capability to trigger a post-event. To provide a clear picture, EVT operators are primarily designed to accomplish three tasks:

  • Modify or transform event data.
  • Opt to not forward an event, often referred to as "swallowing" an event.
  • Maintain an internal state.

In relation to bufferTime, it's feasible to craft an operator that amasses events into an array. However, the system limitation lies in that we cannot predetermine that the buffer should be purged every X milliseconds.
We can only establish that upon receiving a new event, the buffer should be cleared if more than X milliseconds have elapsed. This, admittedly, diverges from our desired outcome.

However, this limitation doesn't signify that EVT cannot accommodate such scenarios. I have put together a bufferTime implementation using a standard function in this playground: EVT Playground

Moreover, it's worth noting that we have charted plans for the upcoming EVT v3 which includes the functionality of enabling operators to delay posts. For more details, you may refer to the EVT v3 roadmap.

I hope that this option constitute a satisfactory solution to your query. Please don't hesitate to reach out if you require any further clarification or insights.

Best Regards

@Joel-PeakMetrics
Copy link
Author

Joel-PeakMetrics commented Jul 2, 2023 via email

@garronej
Copy link
Owner

garronej commented Jul 3, 2023

Unfortunately I have no precise timeline.

I would like to introduce ts-pattern into EVT, I feel it has the potential of greatly improving the developper experience.

However I can't proceede until this PR gets merged.
I won't introduce a dependency that isn't published on deno.land/x.

Best,

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

No branches or pull requests

2 participants