首页 > 其他 > 详细

SAP UI5应用的调试标志位的本地存储逻辑 - local storage使用的一个例子

时间:2020-08-21 15:11:45      阅读:60      评论:0      收藏:0      [点我收藏+]

We know that once we enable debug mode via “Ctrl+Alt+Shift+P”, this setting will be persisted: even if you turn off your laptop and launch the application tomorrow, the debug mode will still be there.

技术分享图片

In Chrome development tool, there is an Application tab which records this setting via key value pair using Local Storage.

技术分享图片

As usual we can still use debug to investigate what has happened when the checkbox “Use Debug Sources(reload)” is clicked.
In Chrome development tool Elements tab, click the small arrow icon to enter the element inspection mode, then click the checkbox, then its html source code will be automatically navigate.

技术分享图片

Perform global search via keyword “useDbgSources”, and then we can find the event handler onUseDbgSources for debug mode set:

技术分享图片

Set a breakpoint on this function, then mark the checkbox in UI, breakpoint is triggered as expected:

技术分享图片

Within the function, we can know the debugging flag is set via localStoage API: window.localStorage.setItem

技术分享图片

This API will change the following file in my laptop:

技术分享图片
技术分享图片

If I open the changed file via some SQLite management tool, I can find the corresponding entry with key sap-ui-debug and value ‘X’ set:

技术分享图片

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
技术分享图片

SAP UI5应用的调试标志位的本地存储逻辑 - local storage使用的一个例子

原文:https://www.cnblogs.com/sap-jerry/p/13540568.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!