Skip to content

Commit 2b3dc21

Browse files
Instructions to debug Quicklink
1 parent 09907bb commit 2b3dc21

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

CONTRIBUTING.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,65 @@ again.
1818
## Code reviews
1919

2020
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
2323
information on using pull requests.
2424

2525
## Community Guidelines
2626

2727
This project follows [Google's Open Source Community
2828
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

Comments
 (0)