From 75c86a8f7fb5ad2b04dc410b04c928c9f9d94c0c Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 23 Feb 2018 02:53:36 +0900 Subject: [PATCH] :v: --- src/web/app/ch/router.ts | 32 ----------------------------- src/web/app/ch/script.ts | 3 --- src/web/app/dev/router.ts | 42 --------------------------------------- src/web/app/dev/script.ts | 3 --- 4 files changed, 80 deletions(-) delete mode 100644 src/web/app/ch/router.ts delete mode 100644 src/web/app/dev/router.ts diff --git a/src/web/app/ch/router.ts b/src/web/app/ch/router.ts deleted file mode 100644 index f10c4acdf..000000000 --- a/src/web/app/ch/router.ts +++ /dev/null @@ -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]; -} diff --git a/src/web/app/ch/script.ts b/src/web/app/ch/script.ts index e23558037..4c6b6dfd1 100644 --- a/src/web/app/ch/script.ts +++ b/src/web/app/ch/script.ts @@ -7,12 +7,9 @@ import './style.styl'; require('./tags'); import init from '../init'; -import route from './router'; /** * init */ init(() => { - // Start routing - route(); }); diff --git a/src/web/app/dev/router.ts b/src/web/app/dev/router.ts deleted file mode 100644 index fcd2b1f76..000000000 --- a/src/web/app/dev/router.ts +++ /dev/null @@ -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]; -} diff --git a/src/web/app/dev/script.ts b/src/web/app/dev/script.ts index b115c5be4..bb4341119 100644 --- a/src/web/app/dev/script.ts +++ b/src/web/app/dev/script.ts @@ -7,12 +7,9 @@ import './style.styl'; require('./tags'); import init from '../init'; -import route from './router'; /** * init */ init(() => { - // Start routing - route(); });