chore(*): remove document-ready

This commit is contained in:
qingwei.li 2017-08-15 23:46:47 +08:00
commit b7735066ff
2 changed files with 13 additions and 2 deletions

View file

@ -30,7 +30,6 @@
"pub": "sh build/release.sh" "pub": "sh build/release.sh"
}, },
"dependencies": { "dependencies": {
"document-ready": "^2.0.1",
"marked": "^0.3.6", "marked": "^0.3.6",
"prismjs": "^1.6.0", "prismjs": "^1.6.0",
"tinydate": "^1.0.0", "tinydate": "^1.0.0",

View file

@ -1,4 +1,3 @@
import ready from 'document-ready'
import { initMixin } from './init' import { initMixin } from './init'
import { routerMixin } from './router' import { routerMixin } from './router'
import { renderMixin } from './render' import { renderMixin } from './render'
@ -6,6 +5,19 @@ import { fetchMixin } from './fetch'
import { eventMixin } from './event' import { eventMixin } from './event'
import initGlobalAPI from './global-api' import initGlobalAPI from './global-api'
/**
* Fork https://github.com/bendrucker/document-ready/blob/master/index.js
*/
function ready (callback) {
const state = document.readyState
if (state === 'complete' || state === 'interactive') {
return setTimeout(callback, 0)
}
document.addEventListener('DOMContentLoaded', callback)
}
function Docsify () { function Docsify () {
this._init() this._init()
} }