/*
 * @Author: 念一
 * @Date: 2021-04-23 21:02:48
 * @LastEditTime: 2021-05-16 13:14:37
 * @LastEditors: Please set LastEditors
 * @Description: webwork
 * @FilePath: /easyvadmin/src/scripts/utils/webwork.ts
 */

export default class WebWorker {
  onmessage: ((this: Worker, ev: MessageEvent<any>) => any) | null;
  postMessage(arg: any) {
    throw new Error('Method not implemented.');
  }
  constructor(worker, o) {
    const code = worker.toString();
    const blob = new Blob(['(' + code + ')()']);
    return new Worker(URL.createObjectURL(blob), o);
  }
}
