discord-client/webpack/main.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-03-21 17:44:27 +00:00
/* (1) Imports
---------------------------------------------------------*/
/* (1) NPM libs */
import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
/* (2) Vues */
import wrapper from './vue/wrapper.vue'
/* (3) Data */
require('./common.js');
/* (2) Initialisation
---------------------------------------------------------*/
/* (1) Render view */
Vue.use(VueRouter);
new Vue({
el: '#vue',
router: gs.get.router,
render(h){ return h(wrapper); }
})
/* (2) Store route params */
window.initial_link = gs.get.router.history.current.params.link;
console.log(`[channel.URL] ${initial_link}`);
/* (3) Channel data gathering
---------------------------------------------------------*/
/* (1) Fetch channel data */
setTimeout(() => {
/* (2) Fetch data */
gs.get.channel.dump( require('./mockup/channels.json') );
/* (3) Find if @link matches */
var redirect_id = null;
for( let c of gs.get.channel.list ){
if( c.link === window.initial_link ){
redirect_id = c.id;
break;
}
}
/* (4) Emulate navigatation from URL */
console.log(`[restore.channel] ${redirect_id}`);
gs.get.channel.nav(redirect_id);
}, 500);