一个协议(或接口),用于接收 LynxView 实例的所有 Console 消息。
目前仅支持获取使用 PrimJS 引擎时的 BTS Console 消息。
实现 LynxInspectorConsoleDelegate 协议(或接口),通过 onConsoleMessage 方法接收 Console 消息。
所有数据均为 JSON 格式的字符串。
对于 Object 类型数据,只包含该 Object 的基本信息,可以通过 getConsoleObject 来进一步获取详细数据。
| 字段 | 类型 | 说明 |
|---|---|---|
| type | string | 日志类型,如 log, debug, info, error, warning 等 |
| args | array[argument] | 日志参数,数组类型,每个元素为一个 argument 对象 |
| 字段 | 类型 | 说 明 |
|---|---|---|
| type | string | 参数类型,如 string, number, boolean, object, function, undefined 等 |
| subtype | string | 可选字段,参数的子类型,如 array, null, error 等,仅对 Object 类型参数有效 |
| objectId | string | 可选字段,参数为 Object 类型时的唯一标识符 |
| description | string | 可选字段,参数的描述信息 |
| value | any | 可选字段,参数的值 |
上述代码会触发 onConsoleMessage 事件,事件数据如下:
取出其中第二个参数的 objectId 字段,进一步调用 getConsoleObject 方法。
当 needStringify 为 false 时,返回的数据如下:
当 needStringify 为 true 时,返回的数据如下:
LynxInspectorConsoleDelegate。LynxBaseInspectorOwner 实例。LynxInspectorConsoleDelegate。LCD tables only load in the browser