@@ -69,10 +69,33 @@ digest duration for several selectors and print sorted table starting with the s
69
69
70
70
All snippets, including mine are distributed under MIT license.
71
71
72
- ## Remote download
72
+ ## Updating local code snippets
73
73
74
- You can download and run a snippet by using the following boilerplate
75
- (scripts are via downloaded via [ RawGit] ( https://rawgit.com/ ) )
74
+ You can update local code snippets by downloading new versions from this github repository.
75
+ Create a code snippets and copy source from [ update-code-snippets.js] ( update-code-snippets.js ) .
76
+
77
+ You will run this code snippet in an unusual way. First, open any web page, even an empty tab.
78
+ Open the DevTools in ** undocked** mode (Command+Option+I on Mac). Then open the DevTools ** again** ,
79
+ * while focused* on the first DevTools. This will open the second DevTools instance with the source for the
80
+ first DevTools panels. If you inspect the ` localStorage ` variable in the second DevTools window, you will
81
+ find lots of interesting stuff, including all the code snippets in the ` localStorage.scriptSnippets ` property.
82
+
83
+ Whenever you want to update the your local code snippets in the Chrome DevTools, execute the ` update-code-snippets.js `
84
+ snippet in the second DevTools instance. The update script looks at the your current code snippets and
85
+ tries to download a file with same name from the code snippets github repository (via [ RawGit] [ RawGit ] ).
86
+ If the remote file has been downloaded successfully, it will replace the snippet.
87
+ After all snippets are checked, reopen the DevTools to load the updated source code.
88
+
89
+ ![ update code snippets] ( images/update-code-snippets.png )
90
+
91
+ Note, that only the latest source is downloaded, not any particular release.
92
+ Also, only code snippets with names matching existing files in this repo are replaced. If you do not
93
+ want to override a code snippet - just rename it, for example, remove the ` .js ` extension.
94
+
95
+ ## Remote download a single script
96
+
97
+ You can download and run a single snippet by using the following boilerplate
98
+ (scripts are via downloaded via [ RawGit] [ RawGit ] )
76
99
77
100
``` js
78
101
(function firstPaintRemote () {
@@ -109,3 +132,4 @@ Support: if you find any problems with this module, email / tweet /
109
132
[ 2 ] : http://bahmutov.calepin.co/performance-profiling-using-devtools-code-snippets.html
110
133
[ 3 ] : http://bahmutov.calepin.co/improving-angular-web-app-performance-example.html
111
134
[ measure ] : http://bahmutov.calepin.co/measure-space-allocation.html
135
+ [ RawGit ] : (https://rawgit.com/)
0 commit comments