basic functions

Signed-off-by: Bernhard Kapelari <bernhard@kapelari.com>

First feedback

Signed-off-by: Bernhard Kapelari <bernhard@kapelari.com>

lint:fix

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Bernhard Kapelari
2020-12-16 18:37:20 +01:00
committed by Julius Härtl
parent 8aa4fdcec5
commit 7b57c92f12
9 changed files with 536 additions and 20 deletions

View File

@@ -26,25 +26,64 @@ import './shared-init.js'
const debug = process.env.NODE_ENV !== 'production'
let _imports = null
const getAsyncImports = async () => {
if (_imports) {
return _imports
}
const { default: Vue } = await import('vue')
const { default: Vuex } = await import('vuex')
const { default: dashboard } = await import('./store/dashboard.js')
Vue.prototype.t = t
Vue.prototype.n = n
Vue.prototype.OC = OC
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
dashboard,
},
strict: debug,
})
_imports = {
store, Vue,
}
return _imports
}
document.addEventListener('DOMContentLoaded', () => {
OCA.Dashboard.register('deck', async (el) => {
const { default: Vue } = await import('vue')
const { default: Vuex } = await import('vuex')
const { default: dashboard } = await import('./store/dashboard.js')
const { Vue, store } = await getAsyncImports()
const { default: DashboardUpcoming } = await import('./views/DashboardUpcoming.vue')
const { default: Dashboard } = await import('./views/Dashboard.vue')
Vue.prototype.t = t
Vue.prototype.n = n
Vue.prototype.OC = OC
Vue.use(Vuex)
const View = Vue.extend(DashboardUpcoming)
const vm = new View({
propsData: {},
store,
}).$mount(el)
return vm
})
const store = new Vuex.Store({
modules: {
dashboard,
},
strict: debug,
})
const View = Vue.extend(Dashboard)
OCA.Dashboard.register('deckToday', async (el) => {
const { Vue, store } = await getAsyncImports()
const { default: DashboardToday } = await import('./views/DashboardToday.vue')
const View = Vue.extend(DashboardToday)
const vm = new View({
propsData: {},
store,
}).$mount(el)
return vm
})
OCA.Dashboard.register('deckTomorrow', async (el) => {
const { Vue, store } = await getAsyncImports()
const { default: DashboardTomorrow } = await import('./views/DashboardTomorrow.vue')
const View = Vue.extend(DashboardTomorrow)
const vm = new View({
propsData: {},
store,