本文整理匯總了TypeScript中page.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: startRouters
export default function startRouters() {
detailRouter((ctx: Context) => {
logger.debug('Detail route');
const name = ctx.params.name;
getDetailByName(name).then(onDetailFromNetwork);
updateCurrentPage({ name: 'DETAIL_PAGE' });
});
homeRouter(ctx => {
logger.debug('Home route');
getList().then(onListFromNetwork);
updateCurrentPage({ name: 'HOME_PAGE' });
});
page();
}
示例2: init
const init = function init(store) {
page('/', function () {
store.dispatch({ type: 'SHOW_ALL' })
});
page('/show_all', function () {
store.dispatch({ type: 'SHOW_ALL' })
});
page('/show_active', function () {
store.dispatch({ type: 'SHOW_ACTIVE' })
});
page('/show_completed', function () {
store.dispatch({ type: 'SHOW_COMPLETED' })
});
page();
};
示例3: page
const module: ModuleDefinition = ({ app }) => {
app.on('initialized', () =>
page.start({
hashbang: true,
})
)
page.redirect('/', '/all')
page('/:filter', ({ path, params }) =>
app.runSequence(path, sequences.changeFilter, params)
)
return {
reactions,
state,
sequences,
providers,
}
}
示例4: homeRouter
function homeRouter(onRoute: OnRoute) {
page('', onRoute);
}
示例5: detailRouter
function detailRouter(onRoute: OnRoute) {
page('/detail/:name', onRoute);
}
示例6:
import page from 'page'
import init from './middleware/init'
import render from './middleware/render'
import index from './page/index'
import blog from './page/blog'
import notfound from './page/notfound'
page('*', init, render)
page('/', index)
page('/blog/:slug', blog)
page('*', notfound)
page()