Browse Source

* fixes setImmediate

setimmediate
Lebedev Konstantin 9 years ago
parent
commit
7b8af01c1e
  1. 22
      Sortable.js

22
Sortable.js

@ -1246,15 +1246,18 @@
setImmediate = setTimeout; setImmediate = setTimeout;
if (win.postMessage && !win.importScripts) { if (win.postMessage && !win.importScripts) {
var postMessageIsAsynchronous = true; var postMessageIsAsynchronous = true;
var oldOnMessage = win.onmessage; var oldOnMessage = win.onmessage;
win.onmessage = function () { postMessageIsAsynchronous = false; }; win.onmessage = function () {
win.postMessage('', '*'); postMessageIsAsynchronous = false;
win.onmessage = oldOnMessage; };
if (postMessageIsAsynchronous) { win.postMessage('', '*');
var postMessageQueue = []; win.onmessage = oldOnMessage;
if (postMessageIsAsynchronous) {
var postMessageQueue = [];
var postMessageEventName = 'sortableSetImmediate:' + expando; var postMessageEventName = 'sortableSetImmediate:' + expando;
var onGlobalMessage = function (event) { var onGlobalMessage = function (event) {
if ( if (
@ -1273,10 +1276,9 @@
setImmediate = function (callback) { setImmediate = function (callback) {
postMessageQueue.push(callback); postMessageQueue.push(callback);
win.postMessage(postMessageEventName, '*'); win.postMessage(postMessageEventName, '*');
return handle;
}; };
} }
} }
} }
// Export utils // Export utils

Loading…
Cancel
Save