ftlabs / fruitmachine

View rendering engine
MIT License
247 stars 18 forks source link

View#remove() could be better #15

Closed wilsonpage closed 11 years ago

wilsonpage commented 11 years ago

We currently have:

view.add(someview);

and

view.remove();

It would make more sense if View#remove() mirrored View#add()

view.remove(someview);

possibly still supporting:

view.remove();

@matthew-andrews do you agree with this?

matthew-andrews commented 11 years ago

An other alternative to consider:-

view.children.add(someview);
view.children.remove(someview);

Or

view.addChild(someview);
view.removeChild(someview);

I know how you're fond of single word functions but those function names are crystal clear.

I'm also broadly happy with the single word add, remove API spec'd in your comment above with the slight preference for the more explicit parent.remove(child); type over child.remove();. We could continue to support the latter without docs for now, as you said, and see how people (we) use it.