-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pref: run client scripts only when opening the DevTools Panel (#101)
* pref: run client scripts only when opening the DevTools Panel * refactor: remove unnecessary logic * refactor: create a port in the panel created callback * refactor: variable names * refactor: suppress debug log
- Loading branch information
Showing
7 changed files
with
111 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 1,16 @@ | ||
import { devtools } from "webextension-polyfill"; | ||
import { devtools, runtime } from "webextension-polyfill"; | ||
|
||
devtools.panels.create("SWR", "", "panel.html").then(() => { | ||
devtools.panels.create("SWR", "", "panel.html").then((panel) => { | ||
const port = runtime.connect({ | ||
name: "panel:" devtools.inspectedWindow.tabId, | ||
}); | ||
panel.onHidden.addListener(() => { | ||
// console.log("hide panel"); | ||
port.postMessage({ type: "panelhide" }); | ||
}); | ||
panel.onShown.addListener(() => { | ||
// console.log("show panel"); | ||
port.postMessage({ type: "panelshow" }); | ||
}); | ||
console.log("The DevTools panel has been created"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b04c3da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
swr-devtools – ./
swr-devtools-git-main-koba04.vercel.app
swr-devtools-koba04.vercel.app
swr-devtools.vercel.app