Chrome的 DevTools能够说是最强大的浏览器开发调试工具了,它的Console
模块又是最高频使用的模块之一,Console
模块提供了不少Command Line API
方便咱们的开发调试。例如:javascript
须要注意的是上例API区别于console
APIhtml
Command Line API
仅能在Chrome DevTools Console
中使用。若是尝试在脚本中调用它们,它们将没法工做。java
那有没有什么办法知道Chrome目前提供了哪些Command Line API
呢。web
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script> var keyList = Reflect.ownKeys(window); </script>
<script> </script>
</body>
</html>
复制代码
Console
中执行var keyList2 = Reflect.ownKeys(window);
keyList2.filter(key=>!keyList.includes(key));
复制代码
Command Line API
。["dir", "dirxml", "profile", "profileEnd", "clear", "table", "keys", "values", "debug", "undebug", "monitor", "unmonitor", "inspect", "copy", "queryObjects", "$_", "$0", "$1", "$2", "$3", "$4", "getEventListeners", "monitorEvents", "unmonitorEvents", "$", "$$", "$x"]
复制代码