You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-2
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@ This project was inspired by comlink, and it started out as a way for me to bett
8
8
## How does it work?
9
9
10
10
In your background script, you must create a BackgroundHandler class and pass it an object that contains the property and methods that you want to share:
11
-
```
11
+
12
+
```js
12
13
// background.js
13
14
14
15
functionremoteFunction() {
@@ -22,7 +23,8 @@ let bgHandler = new BackgroundHandler({
22
23
```
23
24
24
25
In your content script, you should create a BackgroundScript class and then use it in this way:
25
-
```
26
+
27
+
```js
26
28
var bgScript =newBackgroundScript();
27
29
28
30
asyncfunctionfoo() {
@@ -34,3 +36,32 @@ async function foo() {
34
36
35
37
}
36
38
```
39
+
40
+
## Installation
41
+
42
+
Download the `bgscript.js` file and include it in your chrome extension in the following two ways.
43
+
44
+
In order to use it in your content scripts, include it in your manifest.json as the first content script:
0 commit comments