xwt
2 天以前 0d3eadb50310ca60b8871e967e64da01aa25a9ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
declare namespace UniNamespace {
  interface GeneralCallbackResult {
    /**
     * 错误信息
     */
    errMsg: string;
  }
 
  /**
   * 小程序错误事件的监听函数
   */
  type OnAppErrorCallback = (
    /** 错误信息,包含堆栈 */
    error: string
  ) => void;
 
  /**
   * onError 传入的监听函数。不传此参数则移除所有监听函数。
   */
  type OffAppErrorCallback = (res: GeneralCallbackResult) => void;
 
  interface SourceError {
    subject?: string;
    code?: number;
    message?: string;
    cause?: SourceError | AggregateError;
  }
 
  // 聚合源错误信息
  interface AggregateError extends SourceError {
    errors: Array<SourceError | AggregateError>;
  }
 
  interface UniError {
    errSubject: string;
    errCode: number;
    errMsg: string;
    data?: object;
    cause?: SourceError | AggregateError;
  }
}
 
interface Uni {
  /**
   *
   * 需要基础库: `2.1.2`
   *
   * 在插件中使用:不支持
   *
   * 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。
   *
   * 文档: [https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html)
   */
  onError(listener: UniNamespace.OnAppErrorCallback): void;
 
  /**
   *
   * 需要基础库: `2.1.2`
   *
   * 在插件中使用:不支持
   *
   * 移除小程序错误事件的监听函数
   *
   *
   * 文档: [https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html)
   */
  offError(listener?: UniNamespace.OffAppErrorCallback): void;
}