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

Allow scoping the time travel vtree$ or something else #11

Closed
staltz opened this issue Aug 30, 2015 · 2 comments
Closed

Allow scoping the time travel vtree$ or something else #11

staltz opened this issue Aug 30, 2015 · 2 comments
Assignees

Comments

@staltz
Copy link
Member

staltz commented Aug 30, 2015

Currently the implementation does DOM.get('.stream', 'mousemove') which is dangerous in case the application has elements with classname stream. To avoid this global problem, you can use namespaced nested dialogues. Read here http://staltz.com/unidirectional-user-interface-architectures.html and see this example: https://github.com/cyclejs/todomvc-cycle/blob/master/src/components/todo-item.js#L5-L7

That would require adding another parameter name to makeTimeTravel, but should suffice.

PS: it really looks like makeTimeTravel is just another nested dialogue. Meaning it's a Cycle.js component. I prefer the name timeTravel instead of makeTimeTravel (the former is a dialogue function, the latter sounds like a factory, reminds me of driver factories). I'm also more and more considering to use an uppercase naming convention for dialogues (TimeTravel, MagicButton, MyFavoriteComponent, etc), I know this convention is normally used for OOP in JavaScript, but Cycle.js isn't anyway OOP. Well, I'm going too far with this PS.

@Widdershin
Copy link
Member

Yep, I'll do this.

I had designed makeTimeTravel to loosely follow the nested dialogue pattern. The reason it's named makeTimeTravel is because it has a child property called timeTravel and the user can't name the returned object timeTravel.

I actually quite like the idea of using UpperCase. Maybe something like:

const timeTravel = TimeTravel(DOM, [{count$}]);
timeTravel.streams.count$

instead of

const {timeTravel, timeTravelDOM} = makeTimeTravel(DOM, [{count$}]);
timeTravel.count$

@Widdershin Widdershin self-assigned this Aug 30, 2015
@staltz
Copy link
Member Author

staltz commented Aug 31, 2015

Me too! And I might be using that in some of my apps as well, let's see

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