在最新的 Zebra 移动企业浏览器 3.3 EB Javascipt 对象中,应转储以供参考。 这是在 Android 11 中运行的基于 webkit 的现代浏览器。
我尝试转储日志对象(https://techdocs.zebra.com/enterprise-browser/3-3/api/log/)使用
JSON.stringify(EB.Log)
但这输出未定义。
按名称访问对象属性
EB.Log.filePath
或
EB.Application.version
返回正确的数据。
如何在属性名称未知时转储整个对象内容,尽可能多的数据?
JSON.stringify() 适用于某些企业浏览器 API (https://techdocs.zebra.com/enterprise-browser/3-3/api/) 对象:
JSON.stringify(EB.Battery.batteryStatus({}))
JSON.stringify(EB.SignalIndicators.wlanStatus())
对于 EB.SmartCradle 对象 getAllProperties() 返回数据:
JSON.stringify(EB.SmartCradle.getAllProperties())
对于某些对象 JSON.stringify 不返回数据:
JSON.stringify(EB.Log)
JSON.stringify(EB.Application)
JSON.stringify(EB.Barcode.getSupportedProperties())
Application 和 Log 对象没有
getAllProperties()
和 getSupportedProperties()
方法,因此不能使用它们。
按名称访问属性有效,但属性名称未知,如果 Zebra 更改 API,属性名称可能会更改。
浏览器控制台在移动浏览器中不容易访问。应使用 javascript 检索对象数据。
如何以人类可读的形式转储 js 对象以供参考?