amis-rpc-design/node_modules/rc-overflow/es/hooks/channelUpdate.js
2023-10-07 19:42:30 +08: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);
}
}