feat: init ocsify-server-renderer

This commit is contained in:
qingwei.li 2017-05-29 22:24:38 +08:00 committed by cinwell.li
commit 6dea685fee
8 changed files with 124 additions and 7 deletions

View file

@ -1,7 +1,6 @@
import { AbstractHistory } from './history/abstract'
import { HashHistory } from './history/hash'
import { HTML5History } from './history/html5'
import { supportsPushState, inBrowser } from '../util/env'
import { supportsPushState } from '../util/env'
export function routerMixin (proto) {
proto.route = {}
@ -16,8 +15,6 @@ export function initRouter (vm) {
if (mode === 'history' && supportsPushState) {
router = new HTML5History(config)
} else if (!inBrowser || mode === 'abstract') {
router = new AbstractHistory(config)
} else {
router = new HashHistory(config)
}

View file

@ -4,12 +4,10 @@ export const isIE = UA && /msie|trident/.test(UA)
export const isMobile = document.body.clientWidth <= 600
export const inBrowser = typeof window !== 'undefined'
/**
* @see https://github.com/MoOx/pjax/blob/master/lib/is-supported.js
*/
export const supportsPushState = inBrowser && (function () {
export const supportsPushState = (function () {
// Borrowed wholesale from https://github.com/defunkt/jquery-pjax
return window.history &&
window.history.pushState &&