PromoCursed/node_modules/rc-overflow/es/hooks/channelUpdate.js
2024-08-20 23:25:37 +04:00

12 lines
324 B
JavaScript

import raf from "rc-util/es/raf";
export default function channelUpdate(callback) {
if (typeof MessageChannel === 'undefined') {
raf(callback);
} else {
var channel = new MessageChannel();
channel.port1.onmessage = function () {
return callback();
};
channel.port2.postMessage(undefined);
}
}