I'm reading through this Flux tutorial and the objects are created there like this:
var AppDispatcher = assign({}, Dispatcher.prototype, {
/**
* A bridge function between the views and the dispatcher, marking the action
* as a view action. Another variant here could be handleServerAction.
* @param {object} action The data coming from the view.
*/
handleViewAction: function(action) {
this.dispatch({
source: 'VIEW_ACTION',
action: action
});
}
});
They use Object.assign through polyfill. Since Object.assign copies all properties to the object as opposed to Object.create(prototype), I'm wondering what their motivation is to copy the properties directly onto AppDispatcher. Any ideas?