Skip to content

Commit

Permalink
custom init event
Browse files Browse the repository at this point in the history
  • Loading branch information
kondaurovDev committed Dec 22, 2024
1 parent 8cfc4c6 commit 028747b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/telegram-bot-playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<title>Telegram Bot Playground</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script defer src="https://cdn.jsdelivr.net/npm/@monaco-editor/[email protected]/lib/umd/monaco-loader.min.js"></script>
<script defer src="./scripts/init.js?v=qp2taj" type="module"></script>
<script defer src="./scripts/init.js?v=60sdgc" type="module"></script>
<script defer src="./scripts/main.js?v=bgip" type="module"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>

<link rel="stylesheet" href="styles.css?v=oq5lin">

<script>
document.addEventListener('alpine:initialized', async () => {
document.addEventListener('playgroundInitialized', async () => {
await playground.start();
playground.onCodeChange(() => {
playground.runBot(botState);
Expand Down
2 changes: 1 addition & 1 deletion docs/telegram-bot-playground/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"styles.css": "oq5lin",
"init.js": "qp2taj",
"init.js": "60sdgc",
"main.js": "bgip",
"web-worker.js": "7hqmn5"
}
1 change: 1 addition & 0 deletions docs/telegram-bot-playground/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ if (version) {
const worker = new Worker(`./scripts/web-worker.js?v=${version}`, { type: "module" });
window.playground.worker = worker;
console.log("web worker has been loaded");
document.dispatchEvent(new Event("playgroundInitialized"));
} else {
console.warn("web worker not initiated");
}
Expand Down
3 changes: 2 additions & 1 deletion src/tg-bot-playground/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const version: string = await (
if (version) {
const worker = new Worker(`./scripts/web-worker.js?v=${version}`, { type: "module" });
window.playground.worker = worker;
console.log("web worker has been loaded")
console.log("web worker has been loaded");
document.dispatchEvent(new Event('playgroundInitialized'));
} else {
console.warn("web worker not initiated")
}
Expand Down

0 comments on commit 028747b

Please sign in to comment.