Files
dmxconnect/frontend/src/main.js
2024-11-01 20:10:28 +00:00

51 lines
1.1 KiB
JavaScript

import App from './App.svelte';
import { WindowSetTitle } from "../wailsjs/runtime/runtime"
import {currentProject, needProjectSave} from './stores.js';
// Load dictionaries
import { addMessages, init } from 'svelte-i18n';
// Import dictionaries
import en from './lang/en.json';
// Add dictionaries to svelte-i18n
addMessages('en', en);
// Initialize svelte-i18n dictionaries
init({
fallbackLocale: 'en',
initialLocale: 'en',
});
// Create the main app
const app = new App({
target: document.body,
});
// Set the initial title
WindowSetTitle("DMXConnect")
// When the current project data is modified, pass it to unsaved and change the title
let title;
currentProject.subscribe(value => {
needProjectSave.set(true)
title = value.Name
});
// If the project need to be saved, show the information in the title
needProjectSave.subscribe(value => {
if (value) {
console.log(`<!> The current project need to be save`);
WindowSetTitle("DMXConnect - " + title + " (unsaved)")
} else {
WindowSetTitle("DMXConnect - " + title)
}
})
document.addEventListener("DOMContentLoaded", function() {
});
export default app;