sendMessage.js 436 B

1234567891011121314151617
  1. /* global __resourceQuery WorkerGlobalScope */
  2. // Send messages to the outside, so plugins can consume it.
  3. /**
  4. * @param {string} type
  5. * @param {any} [data]
  6. */
  7. function sendMsg(type, data) {
  8. if (typeof self !== "undefined" && (typeof WorkerGlobalScope === "undefined" || !(self instanceof WorkerGlobalScope))) {
  9. self.postMessage({
  10. type: "webpack".concat(type),
  11. data: data
  12. }, "*");
  13. }
  14. }
  15. export default sendMsg;