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"]
複製代碼