|
3 | 3 | ## Brief
|
4 | 4 | Our mission at Reactime is to maintain and iterate constantly, but never at the expense of future developers.<br />We know how hard it is to quickly get up to speed and onboard in a new codebase.<br />So, here are some helpful pointers to help you hit the ground running. 🏃🏾💨
|
5 | 5 |
|
6 |
| -### Main Structure |
| 6 | +## Main Structure |
7 | 7 |
|
8 | 8 | In the *src* folder, there are three directories we care about: *app*, *backend*, and *extension*.
|
9 | 9 | ```
|
10 | 10 | src/
|
11 | 11 | ├── app/ # Frontend code
|
12 |
| -│ │ # |
13 | 12 | │ ├── __tests__/ #
|
14 | 13 | │ ├── actions/ # Redux action creators
|
15 | 14 | │ ├── components/ # React components
|
16 | 15 | │ ├── constants/ #
|
17 | 16 | │ ├── containers/ # More React components
|
18 | 17 | │ ├── reducers/ # Redux mechanism for updating state
|
19 | 18 | │ ├── styles/ #
|
20 |
| -│ ├── index.tsx # App component |
| 19 | +│ ├── user_id/ # Mixpanel data collection code |
| 20 | +│ ├── index.tsx # Starting point for root App component |
21 | 21 | │ ├── module.d.ts #
|
22 | 22 | │ └── store.tsx #
|
23 | 23 | │
|
24 |
| -├── backend/ # "Backend" code |
25 |
| -│ │ # |
| 24 | +├── backend/ # "Backend" code (injected into target app) |
| 25 | +│ │ # Focus especially on linkFiber, timeJump, tree, and helpers |
26 | 26 | │ ├── __tests__/ #
|
27 | 27 | │ ├── types/ # Typescript interfaces
|
28 | 28 | │ ├── helpers.js #
|
|
33 | 33 | │ ├── module.d.ts #
|
34 | 34 | │ ├── package.json #
|
35 | 35 | │ ├── puppeteerServer.js #
|
36 |
| -│ ├── readme.md # |
37 |
| -│ ├── timeJump.ts # Rerenders DOM based on snapshot from background |
| 36 | +│ ├── timeJump.ts # Rerenders DOM based on snapshot from background script |
38 | 37 | │ └── tree.ts # Custom structure to send to background
|
39 | 38 | │
|
40 | 39 | ├── extension/ # Chrome Extension code
|
| 40 | +│ ├── build/ # Destination for bundles and manifest.json (Chrome config file) |
41 | 41 | │ │ #
|
42 |
| -│ ├── build/ # Destination for bundles |
43 |
| -│ │ # and manifest.json (Chrome config file) |
44 |
| -│ │ # |
45 |
| -│ ├── background.js # |
46 |
| -│ └── contentScript.ts # |
| 42 | +│ ├── background.js # Chrome Background Script |
| 43 | +│ └── contentScript.ts # Chrome Content Script |
47 | 44 | └──
|
48 | 45 | ```
|
49 | 46 |
|
@@ -84,11 +81,11 @@ Still unsure about what contents scripts and background scripts do for Reactime,
|
84 | 81 | - In other words, a background script works as a sort of middleman, directly maintaining connection with its parent extension, and acting as a proxy enabling communication between it and the content script.
|
85 | 82 |
|
86 | 83 |
|
87 |
| -### Data Flow |
| 84 | +## Data Flow |
88 | 85 |
|
89 | 86 | The general flow of data is described in the following steps:
|
90 | 87 |
|
91 |
| - |
| 88 | + |
92 | 89 |
|
93 | 90 | 1. When the background bundle is loaded by the browser, it executes a script injection into the dom. (see section on *backend*). This script uses a technique called [throttle](https://medium.com/@bitupon.211/debounce-and-throttle-160affa5457b) to send state data from the app to the content script every specified milliseconds (in our case, this interval is 70ms).
|
94 | 91 |
|
|
0 commit comments