Commit f50e2554 authored by Jérome Perrin's avatar Jérome Perrin

merge waitForDragover in waitForDrop

parent dffb297b
...@@ -588,18 +588,6 @@ ...@@ -588,18 +588,6 @@
gadget.notifyDataChanged(); gadget.notifyDataChanged();
} }
// This will register a dragover handler that prevents default on the event,
// so that we can wait for drop
// TODO: add in waitForDrop
function waitForDragover(gadget) {
return loopEventListener(
gadget.props.main,
'dragover',
false,
function () {return undefined; }
);
}
function waitForDrop(gadget) { function waitForDrop(gadget) {
var callback; var callback;
function canceller() { function canceller() {
...@@ -637,7 +625,12 @@ ...@@ -637,7 +625,12 @@
gadget.props.main.addEventListener('drop', callback, false); gadget.props.main.addEventListener('drop', callback, false);
} }
return new RSVP.Promise(resolver, canceller); return new RSVP.all( [
// loopEventListener adds an event listener that will prevent default for
// dragover
loopEventListener(gadget.props.main, 'dragover', false,
function () {return undefined; }),
RSVP.Promise(resolver, canceller) ]);
} }
initGadgetMixin(gadget_klass); initGadgetMixin(gadget_klass);
...@@ -680,7 +673,6 @@ ...@@ -680,7 +673,6 @@
}); });
return RSVP.all([ return RSVP.all([
waitForDragover(gadget),
waitForDrop(gadget), waitForDrop(gadget),
waitForConnection(gadget), waitForConnection(gadget),
waitForConnectionDetached(gadget), waitForConnectionDetached(gadget),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment