Closed alexmingoia closed 10 years ago
It is potentially feasible, but it's limited compared to the power that built from day one could offer...
For example, async events are much easier with co-emitter where you can use generators to yield execution to async events. This always felt dirty in modella, and is a big enhancement of moko.
The big problem is how does modella know when to yield to things on async (for example model.save) vs use a callback. Supporting both, if possible, would be a massive hack.
Other improvements over modella, in my opinion:
save
has a force
option, allowing skipping of validationerrors
now returns an object with attr: [Array]
instead of just an array of objects. Furthermore, you can do errors(attr)
for just a specific one.user.name = 'Bob'
instead of user.name('bob');
yeah that makes sense. cool!
Is it not feasible to add an option to Modella to wrap all the functions that take a callback for use with co?