在 bash 中,我使用历史搜索向前和历史搜索向后功能来允许我输入要运行的命令的几个字符,然后按向上箭头循环浏览历史记录中与这些字符匹配的项目。
我想要 chrome devtool 控制台也有同样的东西。我经常使用向上箭头来循环浏览我的历史记录,但似乎没有办法过滤它。有人有聪明的解决方案吗?
[请注意,命令历史匹配在最新版本的 Chrome 中得到了很大改进。这虽然不是我想要的样子,但已经很不错了。]
试试这个:(基于如何删除所有最近的控制台命令 https://stackoverflow.com/questions/21149156/how-to-remove-all-recent-console-command/21149275#21149275)
- 在 Chrome 开发工具窗口中打开 Chrome 开发工具(按照post https://stackoverflow.com/questions/21149156/how-to-remove-all-recent-console-command/21149275#21149275上面)按照第一个答案(Rob W)的步骤 1-3 进行操作。不要执行第 4 步,否则您将清除您的历史记录!
- Run this command in the new Dev Tools console:
JSON.parse(localStorage.getItem('consoleHistory')).filter(function(item){ return ~item.indexOf('indexedDB');})
TL;DR
- 从技术上讲,Chrome 开发工具只是另一个浏览器窗口。
- The
LocalStorage
原始开发工具的内容适用于您正在浏览的网站。
- 通过打开开发工具上的开发工具,您可以
LocalStorage
用于开发工具窗口,从而使您可以访问consoleHistory
.
-
localStorage.getItem('consoleHistory')
给你一个数组的字符串,所以你需要解析它(即JSON.parse()
)回到Array
所以你可以filter
it.
- The
~
在...前面~item.indexOf('indexedDB')
是按位快捷方式item.indexOf('indexedDB') > 0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)