@@ -18,11 +18,65 @@ again.
18
18
## Code reviews
19
19
20
20
All submissions, including submissions by project members, require review. We
21
- use GitHub pull requests for this purpose. Consult
22
- [ GitHub Help] ( https://help.github.com/articles/about-pull-requests/ ) for more
21
+ use GitHub pull requests for this purpose. Consult [ GitHub
22
+ Help] ( https://help.github.com/articles/about-pull-requests/ ) for more
23
23
information on using pull requests.
24
24
25
25
## Community Guidelines
26
26
27
27
This project follows [ Google's Open Source Community
28
28
Guidelines] ( https://opensource.google.com/conduct/ ) .
29
+
30
+ ## Debugging Quicklink
31
+
32
+ The [ test
33
+ folder] ( https://github.com/GoogleChromeLabs/quicklink/tree/master/test ) contains
34
+ several test cases. Make sure to create a new test when building a new feature.
35
+
36
+ Here's an example of how to debug the library by using one of these tests:
37
+ [ test/test-basic-usage.html] ( https://github.com/GoogleChromeLabs/quicklink/blob/master/test/test-basic-usage.html ) .
38
+
39
+ 1 . Comment the following block of code at ` test/test-basic-usage.html ` :
40
+
41
+ ``` javascript
42
+ < script src= " ../dist/quicklink.umd.js" >< / script>
43
+ < script>
44
+ quicklink .listen ();
45
+ < / script>
46
+ ```
47
+
48
+ 2 . Add the following snippet in its place, to import the module from its
49
+ source file:
50
+
51
+ ``` javascript
52
+ < script type= " module" >
53
+ import { listen } from " ../src/index.mjs" ;
54
+ listen ();
55
+ < / script>
56
+ ```
57
+
58
+ 3 . Open
59
+ [ src/index.mjs] ( https://github.com/GoogleChromeLabs/quicklink/blob/master/src/index.mjs )
60
+ for edit and replace the following line:
61
+
62
+ ``` javascript
63
+ import throttle from ' throttles' ;
64
+ ```
65
+
66
+ By:
67
+
68
+ ``` javascript
69
+ import throttle from ' ../node_modules/throttles/dist/index.mjs'
70
+ ```
71
+
72
+ 4 . Build the project: ` npm run build ` .
73
+
74
+ 5 . Start a local server: ` npm run start ` . By default, this will start the local server at ` https://localhost:8080 ` .
75
+
76
+ 6 . Open the file where the modifications where made:
77
+ ` http://localhost:8080/test/test-basic-usage.html ` .
78
+
79
+ 7 . Open Chrome DevTools and go the ** Sources** tab.
80
+
81
+ 8 . Under ` localhost:8080/src ` you can find the unminified versions of the ` Quicklink ` files.
82
+ Now you can use breakpoints and inspect variables to debug the library.
0 commit comments