Skip to content

Commit

Permalink
Use ES6 rest call syntax to clarify intent
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Feb 11, 2015
1 parent 06820e6 commit a13e29e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions modules/mixins/DragDropMixin.js
Expand Up @@ -56,11 +56,15 @@ function checkDropTargetDefined(component, type) {
}

function callDragDropLifecycle(func, component, ...rest) {
if (component && component.constructor._legacyConfigureDragDrop) {
if (component.constructor._legacyConfigureDragDrop) {
return func.apply(component, rest);
}

return func.apply(null, [component].concat(rest));
return func.call(
null,
component.isMounted() ? component : null,
...rest
);
}

var UNLIKELY_CHAR = String.fromCharCode(0xD83D, 0xDCA9),
Expand Down Expand Up @@ -325,12 +329,7 @@ var DragDropMixin = {
});
}

callDragDropLifecycle(
endDrag,
(mounted || this.constructor._legacyConfigureDragDrop) ? this : null, // Don't send static api component if it's unmounted
effect,
e
);
callDragDropLifecycle(endDrag, this, effect, e);
},

dropTargetFor(...types) {
Expand Down

0 comments on commit a13e29e

Please sign in to comment.