
To render an arbitrary part of a page use region parameter. Rendering and restoring the viewport size afterwards. Is equivalent to running splash:set_viewport_full() just before the Splash:set_viewport_full or render_all argument.

To set the viewport size use splash:set_viewport_size, Specified one without resizing the content. If the viewport hasĪ different height, the image is trimmed or extended vertically to match the Height parameter sets the height of the resulting image. Return a screenshot of the whole viewport, but the image will be downscaled to This is similar to entering an URL in a browserĪddress bar, pressing Enter and waiting until page loads. Right-click the Snippet name and select Remove.Go to an URL.Right-click the Snippet name and select Rename.Type the ! character followed by the name of the Snippet that you want to run.įigure 10.

Press Control+O or Command+O (Mac) to open the Command Menu. Click Run Snippet, or press Control+Enter or Command+Enter (Mac).Click the name of the Snippet that you want to run.# Run Snippets # Run a Snippet from the Sources panel An asterisk next to the Snippet name, which indicates unsaved code. Press Control+S or Command+S (Mac) to save.įigure 9. When there's an asterisk next to the name of your Snippet it means you have unsaved code. Use the Code Editor to add JavaScript to your Snippet. In the Snippets pane click the name of the Snippet that you want to edit in order to open it in the Code Editor. Pros: you can use JavaScript within tasks (with ES6/7) and import other npm modules. Tasks can be called by run (or npx run) command in the terminal. See Rename Snippets if you'd like to give your new Snippet a custom name. Allows to define tasks in runfile.js file. Start typing Snippet, select Create new snippet, then press Enter to run the command.įigure 7. # Create a Snippet through the Command Menu # Create Snippets # Create a Snippet through the Sources panelĮnter a name for your Snippet then press Enter to save. Start typing Snippets, select Show Snippets, and then press Enter to run the command. Press Control+Shift+P or Command+Shift+P (Mac) to open the Command Menu. # Open the Snippets pane with the Command Menuįocus your cursor somewhere inside of DevTools. You might need to click More Tabs in order to access the Snippets option. The Sources panel with the Page pane open on the left.Ĭlick the Snippets tab to open the Snippets pane. The idea is to run high-performance applications compiled from languages like C/C++ or Rust.

The Page pane usually opens by default.įigure 4. WebAssembly started as a JavaScript alternative for browsers. # Open the Snippets pane with a mouseĬlick the Sources tab to open the Sources panel. When you want to edit a Snippet, you need to open it from the Snippets pane.įigure 3. How the page looks after running the Snippet. The Console Drawer pops up to display the Hello, Snippets! message that the Snippet logs, and the page's content changes completely.įigure 2. createElement ( 'p' ) įigure 2 shows how the page looks after running the Snippet. Here's the Snippet source code from Figure 1: console. How the page looks before running the Snippet. Firefox DevTools has a feature similar to Snippets called Scratchpad.įor example, Figure 1 shows the DevTools homepage on the left and some Snippet source code on the right.įigure 1. Snippets are an alternative to bookmarklets. They have access to the page's JavaScript context, and you can run them on any page.

Snippets are scripts that you author in the Sources panel. If you find yourself running the same code in the Console repeatedly, consider saving the code as a Snippet instead.
