-
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.
feat: add popup UI, change ext icon with background script, handle ho…
…st app reload for devtools page
- Loading branch information
1 parent
6d39726
commit d2e97d5
Showing
43 changed files
with
335 additions
and
445 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type Konva from "konva"; | ||
|
||
declare global { | ||
interface Window { | ||
Konva: typeof Konva; | ||
} | ||
} | ||
|
||
document.addEventListener("__KONVA_DEVTOOLS__DETECT_KONVA", function (e) { | ||
document.dispatchEvent( | ||
new CustomEvent("__KONVA_DEVTOOLS__DETECTION_RESULT", { | ||
detail: !!window.Konva, | ||
}) | ||
); | ||
}); |
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,7 +1,38 @@ | ||
console.log("content loaded"); | ||
let lastResult = false; | ||
|
||
/** | ||
* @description | ||
* Chrome extensions don't support modules in content scripts. | ||
*/ | ||
import("./components/Demo"); | ||
detect(); | ||
const interval = setInterval(detect, 5000); | ||
|
||
function detect() { | ||
try { | ||
const s = document.createElement("script"); | ||
s.src = chrome.runtime.getURL("src/pages/detector/index.js"); | ||
document.body.appendChild(s); | ||
s.onload = () => { | ||
document.addEventListener( | ||
"__KONVA_DEVTOOLS__DETECTION_RESULT", | ||
function (e: CustomEvent) { | ||
lastResult = e.detail; | ||
|
||
chrome.runtime.sendMessage({ | ||
type: "__KONVA_DEVTOOLS__BROADCAST_RESULT", | ||
result: lastResult, | ||
}); | ||
s.remove(); | ||
} | ||
); | ||
|
||
document.dispatchEvent(new CustomEvent("__KONVA_DEVTOOLS__DETECT_KONVA")); | ||
}; | ||
} catch (error) { | ||
clearInterval(interval); | ||
console.log(error); | ||
} | ||
} | ||
|
||
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { | ||
if (request["type"] == "__KONVA_DEVTOOLS__REQUEST_DETECTION") { | ||
sendResponse(lastResult); | ||
} | ||
return true; // this make sure sendResponse will work asynchronously | ||
}); |
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
<!DOCTYPE html> | ||
<html lang="ko"> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>Devtools</title> | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.