The reason will be displayed to describe this comment to others. Learn more.
This is really good stuff; much cleaner than the previous. My only final note is a recommendation to standardize checks against the indexOf return values... at a glance, >= 0 and < 0 seem to be about equally represented elsewhere in our source (addressing that is a job for another day), so I'd lean towards one of those.
The reason will be displayed to describe this comment to others. Learn more.
I really don't get the prototype-based approach. I like the two Data instances but you'd gain a lot of bytes by using a module based approach to construct said instances. You'd also probably won't have to expose all the methods to boot (another gain). I'm also a bit concerned with the liberal use of indexOf on an array that could end up being quite big (even in apps that never manipulate big collections -- since it will contain all the nodes that have data, am i right?). Have you benchmarked this against an app that attaches data to a lot of nodes concurrently?
7f94a5c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really good stuff; much cleaner than the previous. My only final note is a recommendation to standardize checks against the
indexOf
return values... at a glance,>= 0
and< 0
seem to be about equally represented elsewhere in our source (addressing that is a job for another day), so I'd lean towards one of those.7f94a5c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll go through it now, thanks for the review :)
7f94a5c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't get the prototype-based approach. I like the two Data instances but you'd gain a lot of bytes by using a module based approach to construct said instances. You'd also probably won't have to expose all the methods to boot (another gain). I'm also a bit concerned with the liberal use of indexOf on an array that could end up being quite big (even in apps that never manipulate big collections -- since it will contain all the nodes that have data, am i right?). Have you benchmarked this against an app that attaches data to a lot of nodes concurrently?