forked from lizzard77/vitejs-vite-yv7xdv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
41 lines (38 loc) · 1.43 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import javascriptLogo from './javascript.svg'
import viteLogo from '/vite.svg'
import { setupCounter } from './counter.js'
console.log("Hi from codespaces");
// register a new route. If the user navigates to this route, your callback method will be run
// The callback will be passed a DOM node in which the app must be rendered.
// This sample callback will render a Svelte app into the node.
neherapp3.registerRoute("/demo", "demo", (node) => {
node.innerHTML = `
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="${viteLogo}" class="logo" alt="Vite logo" />
</a>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
<img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" />
</a>
<h1>Hello Vite!</h1>
<div class="card">
<button id="counter" type="button"></button>
</div>
<p class="read-the-docs">
Click on the Vite logo to learn more
</p>
<idas-spinner title="Web Component" />
</div>
`;
setupCounter(document.querySelector('#counter'));
});
const baseUrl = new URL(import.meta.url).origin;
const iconUrl = baseUrl + "/vite.svg";
// Add a new menu item to the main menu that navigates to the route you just registered
neherapp3.addMenuItem({
id : "demo",
icon: iconUrl,
url: "/demo",
text: "Demo App",
parent: "settings" // this is one of "dev", "prod", "sb", "home"
});