|
3 | 3 | let lastReceivedMsgTime = null; |
4 | 4 | chrome.runtime.onMessage.addListener((msg) => { |
5 | 5 | if (msg.codeString) scheduleWork(msg); |
6 | | - else if (msg.injectScripts) injectScripts(); |
7 | 6 | }); |
8 | 7 |
|
9 | | - function injectScripts() { |
10 | | - console.log('injecting scripts...'); |
11 | | - // We add a <script> tag to the DOM with our script files as the src attribute. |
12 | | - // We need this because our content-injected scripts are executed in an "isolated |
13 | | - // world" environment. BUT for the scripts below, we want the edited-React libraries |
14 | | - // to have access to the their functionalities. |
15 | | - const linkedListScript = document.createElement('script'); |
16 | | - linkedListScript.src = chrome.runtime.getURL('scripts/linked_list.js'); |
17 | | - (document.head || document.documentElement).appendChild(linkedListScript); |
18 | | - |
19 | | - const timeTravelScript = document.createElement('script'); |
20 | | - timeTravelScript.src = chrome.runtime.getURL('scripts/time_travel.js'); |
21 | | - (document.head || document.documentElement).appendChild(timeTravelScript); |
22 | | - |
23 | | - const deepCloneScript = document.createElement('script'); |
24 | | - deepCloneScript.src = chrome.runtime.getURL('scripts/deepclone_bundle.js'); |
25 | | - (document.head || document.documentElement).appendChild(deepCloneScript); |
26 | | - |
27 | | - // linkedListScript.onload = |
28 | | - deepCloneScript.onload = timeTravelScript.onload = function removeScriptTag() { |
29 | | - this.remove(); |
30 | | - }; |
31 | | - } |
32 | | - |
33 | 8 | function scheduleWork(work) { |
34 | 9 | // We want to add the scripts to a work array. When its been 100s |
35 | 10 | // without receiving any new scripts, then we sort the array and |
|
59 | 34 | }; |
60 | 35 | } |
61 | 36 | } |
62 | | -}()) |
| 37 | +}()); |
0 commit comments