mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-14 06:38:28 +09:00
✌️
This commit is contained in:
parent
633ab4ef00
commit
75c86a8f7f
@ -1,32 +0,0 @@
|
||||
import * as riot from 'riot';
|
||||
import * as route from 'page';
|
||||
let page = null;
|
||||
|
||||
export default () => {
|
||||
route('/', index);
|
||||
route('/:channel', channel);
|
||||
route('*', notFound);
|
||||
|
||||
function index() {
|
||||
mount(document.createElement('mk-index'));
|
||||
}
|
||||
|
||||
function channel(ctx) {
|
||||
const el = document.createElement('mk-channel');
|
||||
el.setAttribute('id', ctx.params.channel);
|
||||
mount(el);
|
||||
}
|
||||
|
||||
function notFound() {
|
||||
mount(document.createElement('mk-not-found'));
|
||||
}
|
||||
|
||||
// EXEC
|
||||
(route as any)();
|
||||
};
|
||||
|
||||
function mount(content) {
|
||||
if (page) page.unmount();
|
||||
const body = document.getElementById('app');
|
||||
page = riot.mount(body.appendChild(content))[0];
|
||||
}
|
@ -7,12 +7,9 @@ import './style.styl';
|
||||
|
||||
require('./tags');
|
||||
import init from '../init';
|
||||
import route from './router';
|
||||
|
||||
/**
|
||||
* init
|
||||
*/
|
||||
init(() => {
|
||||
// Start routing
|
||||
route();
|
||||
});
|
||||
|
@ -1,42 +0,0 @@
|
||||
import * as riot from 'riot';
|
||||
import * as route from 'page';
|
||||
let page = null;
|
||||
|
||||
export default () => {
|
||||
route('/', index);
|
||||
route('/apps', apps);
|
||||
route('/app/new', newApp);
|
||||
route('/app/:app', app);
|
||||
route('*', notFound);
|
||||
|
||||
function index() {
|
||||
mount(document.createElement('mk-index'));
|
||||
}
|
||||
|
||||
function apps() {
|
||||
mount(document.createElement('mk-apps-page'));
|
||||
}
|
||||
|
||||
function newApp() {
|
||||
mount(document.createElement('mk-new-app-page'));
|
||||
}
|
||||
|
||||
function app(ctx) {
|
||||
const el = document.createElement('mk-app-page');
|
||||
el.setAttribute('app', ctx.params.app);
|
||||
mount(el);
|
||||
}
|
||||
|
||||
function notFound() {
|
||||
mount(document.createElement('mk-not-found'));
|
||||
}
|
||||
|
||||
// EXEC
|
||||
(route as any)();
|
||||
};
|
||||
|
||||
function mount(content) {
|
||||
if (page) page.unmount();
|
||||
const body = document.getElementById('app');
|
||||
page = riot.mount(body.appendChild(content))[0];
|
||||
}
|
@ -7,12 +7,9 @@ import './style.styl';
|
||||
|
||||
require('./tags');
|
||||
import init from '../init';
|
||||
import route from './router';
|
||||
|
||||
/**
|
||||
* init
|
||||
*/
|
||||
init(() => {
|
||||
// Start routing
|
||||
route();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user