amis-rpc-design/node_modules/rc-overflow/es/hooks/channelUpdate.js

12 lines
324 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
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);
}
}