export default {
  /**
   * 初始化全局报错监听
   * @param {*} listener 
   */
  initListener(listener) {
    window.addEventListener('error', e => {
      if (typeof listener !== 'function') return;
      listener({
        message: e.message,
        line: e.lineno,
        column: e.colno,
        stack: e.stack,
        sourceURL: e.filename,
        Error: e,
      });
    }, true);
  }
}