These are chat archives for canjs/canjs

18th
Feb 2016
Adam L Barrett
@BigAB
Feb 18 2016 05:38
This message was deleted
Chasen Le Hara
@chasenlehara
Feb 18 2016 23:41
What is the best way of enforcing unique values in a custom can.List?
I think I could listen to length changes when the list is initialized, but I’m wondering if there’s a better way.
dylanrtt
@dylanrtt
Feb 18 2016 23:47
@chasenlehara you could override push() and similar methods
Chasen Le Hara
@chasenlehara
Feb 18 2016 23:48
Yeah, my concern with that would be how many things I’d need to override to make sure I catch any time an object is added to the list.
dylanrtt
@dylanrtt
Feb 18 2016 23:52
This message was deleted
If you exclude the possibility of someone doing list.attr(5, 'foo'), then probably just init/setup, push() and replace().