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

Convert can-map/can-map-define to DefineMap #36

Open
phillipskevin opened this issue Aug 24, 2017 · 1 comment
Open

Convert can-map/can-map-define to DefineMap #36

phillipskevin opened this issue Aug 24, 2017 · 1 comment

Comments

@phillipskevin
Copy link
Contributor

This isn't a Can 3.0 migrate issue, but it would be nice if we could help people convert their can-maps to DefineMap. If they're already using the can-map-define plugin it should be a little easier.

@perehnbom
Copy link

I upgraded to CanJS 3 early this year, but still use can.Map / can.Model together with can-map-define. The main reason I have not started using DefineMap is the lack of support for event bubbling. can.Map together with can.List has a really strong feature in event bubbling: whenever an event is triggered on a map, it can bubble to lists containing that map.

I have several use cases:

  • on destroy. Whenever a model is destroyed, it is automatically removed from lists where it's present. With event bubbling, this is possible not only with can.Model, but possible on any can.Map by triggering a destroy event.

  • for sorting. By triggering a sort event (custom event) on a can.Map, any list containing it can act on that event and sort itself.

  • filtering. Given a list has a filtered selection of maps, whenever a property is changed on a map, by event bubbling, the list can check whether the map should be removed from the list or not.

To my knowledge, the event bubbling feature is not present in DefineMap, or at least I havent found it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants