-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathmyapp.js
36 lines (30 loc) · 1022 Bytes
/
myapp.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
import "./styles/app.css";
import {JetApp, EmptyRouter, HashRouter, plugins } from "webix-jet";
// dynamic import of views
const modules = import.meta.glob("./views/**/*.js");
const views = name => modules[`./views/${name}.js`]().then(x => x.default);
// locales, optional
const locales = import.meta.glob("./locales/*.js");
const words = name => locales[`./locales/${name}.js`]().then(x => x.default);
export default class MyApp extends JetApp{
constructor(config){
const defaults = {
id : import.meta.env.VITE_APPNAME,
version : import.meta.env.VITE_VERSION,
router : import.meta.env.VITE_BUILD_AS_MODULE ? EmptyRouter : HashRouter,
debug : !import.meta.env.PROD,
start : "/top/start",
// set custom view loader, mandatory
views
};
super({ ...defaults, ...config });
// locales plugin, optional
this.use(plugins.Locale, {
path: words,
storage: this.webix.storage.session
});
}
}
if (!import.meta.env.VITE_BUILD_AS_MODULE){
webix.ready(() => new MyApp().render() );
}