What is the XStream imitate use case

33 Views Asked by At

The docs go over imitate use case, but I don't understand the example made. Where would you call a Parent function, is it like recursive? I'd like to see what the model function looks like, and what the child gets out of it.

1

There are 1 best solutions below

0
On BEST ANSWER

imitate is meant to create a cycle in the graph of streams connected by operators, that's the use case. It would often be seen when building a state stream.

However, nowadays we have a solution in Cycle.js called @cycle/state which solves for that use case, and in Cycle.js there is no need for imitate anymore. We would like to deprecate imitate but we have heard some people still depend on it, so we're postponing the deprecation.

(I'm the creator of xstream and Cycle.js)