使用(实验性)代码段功能从Google Chrome控制台命令行运行代码段? [英] Running code snippets from Google Chrome console command line, using (experimental) code snippets feature?

查看:259
本文介绍了使用(实验性)代码段功能从Google Chrome控制台命令行运行代码段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考:

也提到了


快速查找特定文件的能力对开发人员的工作流程来说可能至关重要。 DevTools允许您使用以下快捷方式搜索所有脚本,样式表和片段文件: code>

Cmd + O(Mac OSX)



无论您目前所在的面板如何。


...和...


键盘快捷方式也可用于轻松执行片段 - 只需选择片段,然后使用Ctrl / Cmd + Enter运行即可。这复制了Run(>)按钮的行为 - 当前在Sources控制台中,但在不久的将来它将移动到调试器控件中。




这意味着,在控制台中,您可以按下 Ctrl / Cmd + O 快速选择您的片段,然后按 Cmd / Control + Enter 来运行它。


Reference:

Using the new code snippets feature in google chrome

I am using the code snippets in google chrome, so say I have a snippet file. check_consistency.js

Is there an api or a global object through which we can run the snippet directly from the command line, something like:

  window.runSnippet('check_consistency.js')

or maybe call methods defined in the snippet directly.

解决方案

Workflow Tip 1

I also want to see this functionality added. Meanwhile, perhaps try opening the Sources where (as you know) you can select a snippet and right click it to run it. You may or may not know that you can tap Esc on this page in order to show the console at the same time as your snippets:

Workflow Tip 2

The snippets documentation also mentions

The ability to quickly locate a specific file can be essential to a developer's workflow. The DevTools allow you to search across all script, stylesheet and snippet files using the following shortcuts:

Ctrl + O (Windows, Linux)
Cmd + O (Mac OSX)

which will work regardless of the panel you are currently in.

...and...

A keyboard shortcut is also available for easily executing a snippet - just select your snippet then use Ctrl/Cmd + Enter to run it. This replicates the behavior of the Run (>) button - currently in the Sources console, but which will be moving into the debugger control in the near future.

What this means is that while in the console you can press Ctrl/Cmd+O to quickly select your snippet, and then press Cmd/Control+Enter to run it.

这篇关于使用(实验性)代码段功能从Google Chrome控制台命令行运行代码段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆