6 ms·
And when you look at the Ember source this is basically what reopen is doing. But (!) writing C.reopen({ foo: function() { /* ... */ }, bar: functio
by MartinMond 15y ago
And when you look at the Ember source this is basically what reopen is doing.
But (!) writing
C.reopen({
foo: function() { /* ... */ },
bar: function() { /* ... */ }
})
instead of
/*window.*/merge(C.prototype, {
foo: function() { /* ... */ },
bar: function() { /* ... */ }
})
makes for easier reading, which is worth a lot in my opinion.
It's the same as Cocoa providing -[NSMutableArray removeLastObject] in addition to -[NSMutableArray removeObjectAtIndex:] and -[NSMutableArray length]
Sure you can express one with the other, but readability matters.