This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
generated from tyn1998/chrome-extension-boilerplate-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: detect __OPENSUMI_DEVTOOLS_GLOBAL_HOOK__ to decide if create th…
…e panel (#49)
- Loading branch information
Showing
3 changed files
with
34 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
chrome.devtools.panels.create( | ||
'OpenSumi DevTools', | ||
'logo.png', | ||
'panel.html' | ||
); | ||
const run = () => { | ||
window.chrome.devtools.inspectedWindow.eval( | ||
`window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__`, | ||
(result, exception) => { | ||
if (exception) { | ||
console.log(exception); | ||
} else { | ||
if (result) { | ||
chrome.devtools.panels.create( | ||
'OpenSumi DevTools', | ||
'logo.png', | ||
'panel.html' | ||
); | ||
} | ||
} | ||
} | ||
); | ||
}; | ||
|
||
run(); |
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