It's not strictly HTML, so that's just correct. This is just worth doing while building the new TypeScript bundle
23 lines
592 B
TypeScript
23 lines
592 B
TypeScript
import Alpine from './vendor/alpinejs-3.15.8.js';
|
|
|
|
// Make Alpine available on window for inline Alpine
|
|
window.Alpine = Alpine;
|
|
|
|
// Wait for DOM to be ready, then initialize Alpine
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
Alpine.start();
|
|
});
|
|
interface GreetingComponent {
|
|
message: string;
|
|
name: string;
|
|
updateMessage(): void;
|
|
}
|
|
|
|
Alpine.data('greeting', (): GreetingComponent => ({
|
|
message: 'Welcome to Alpine + TypeScript!',
|
|
name: 'World',
|
|
|
|
updateMessage() {
|
|
this.message = 'Message updated at ' + new Date().toLocaleTimeString();
|
|
}
|
|
}));
|