mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-24 12:46:08 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e203b07ab | ||
|
|
eff6d21539 | ||
|
|
dc536a3930 | ||
|
|
cc4ffb4ab7 | ||
|
|
d62da2034f | ||
|
|
dd0c84bb40 | ||
|
|
02022af53c | ||
|
|
44d7257691 | ||
|
|
c6f760275c |
@@ -1,3 +1,27 @@
|
|||||||
|
### 2.4.2
|
||||||
|
|
||||||
|
> 2017-02-14
|
||||||
|
|
||||||
|
#### Bug fixes
|
||||||
|
- fix(index): load file path error
|
||||||
|
|
||||||
|
|
||||||
|
### 2.4.1
|
||||||
|
|
||||||
|
> 2017-02-13
|
||||||
|
|
||||||
|
#### Bug fixes
|
||||||
|
- fix(index): cover page
|
||||||
|
|
||||||
|
### 2.4.0
|
||||||
|
|
||||||
|
> 2017-02-13
|
||||||
|
|
||||||
|
#### Features
|
||||||
|
|
||||||
|
- feat(hook): add `doneEach`
|
||||||
|
|
||||||
|
|
||||||
### 2.3.0
|
### 2.3.0
|
||||||
|
|
||||||
> 2017-02-13
|
> 2017-02-13
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
# docsify <small>2.3.0</small>
|
# docsify <small>2.4.2</small>
|
||||||
|
|
||||||
> A magical documentation site generator.
|
> A magical documentation site generator.
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -67,7 +67,7 @@ window.$docsify = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
function (hook) {
|
function (hook) {
|
||||||
hook.init(function() {
|
hook.init(function() {
|
||||||
// Called when the script starts running, only trigger once.
|
// Called when the script starts running, only trigger once, no arguments,
|
||||||
})
|
})
|
||||||
|
|
||||||
hook.beforeEach(function(content) {
|
hook.beforeEach(function(content) {
|
||||||
@@ -84,8 +84,13 @@ window.$docsify = {
|
|||||||
next(html)
|
next(html)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
hook.doneEach(function() {
|
||||||
|
// Invoked each time after the data is fully loaded, no arguments,
|
||||||
|
// ...
|
||||||
|
})
|
||||||
|
|
||||||
hook.ready(function() {
|
hook.ready(function() {
|
||||||
// Called after initialization is complete. Only trigger once.
|
// Called after initialization is complete. Only trigger once, no arguments.
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ window.$docsify = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
function (hook) {
|
function (hook) {
|
||||||
hook.init(function() {
|
hook.init(function() {
|
||||||
// 初始化时调用,只调用一次
|
// 初始化时调用,只调用一次,没有参数。
|
||||||
})
|
})
|
||||||
|
|
||||||
hook.beforeEach(function(content) {
|
hook.beforeEach(function(content) {
|
||||||
@@ -79,8 +79,13 @@ window.$docsify = {
|
|||||||
next(html)
|
next(html)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
hook.doneEach(function() {
|
||||||
|
// 每次路由切换时数据全部加载完成后调用,没有参数。
|
||||||
|
// ...
|
||||||
|
})
|
||||||
|
|
||||||
hook.ready(function() {
|
hook.ready(function() {
|
||||||
// docsify 初始化完成后调用,只调用一次
|
// 初始化完成后调用,只调用一次,没有参数。
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+8
-3
@@ -2818,6 +2818,7 @@ var Hook = function Hook () {
|
|||||||
this.afterHooks = [];
|
this.afterHooks = [];
|
||||||
this.initHooks = [];
|
this.initHooks = [];
|
||||||
this.readyHooks = [];
|
this.readyHooks = [];
|
||||||
|
this.doneEachHooks = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
Hook.prototype.beforeEach = function beforeEach (fn) {
|
Hook.prototype.beforeEach = function beforeEach (fn) {
|
||||||
@@ -2828,6 +2829,10 @@ Hook.prototype.afterEach = function afterEach (fn) {
|
|||||||
this.afterHooks.push(fn);
|
this.afterHooks.push(fn);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Hook.prototype.doneEach = function doneEach (fn) {
|
||||||
|
this.doneEachHooks.push(fn);
|
||||||
|
};
|
||||||
|
|
||||||
Hook.prototype.init = function init (fn) {
|
Hook.prototype.init = function init (fn) {
|
||||||
this.initHooks.push(fn);
|
this.initHooks.push(fn);
|
||||||
};
|
};
|
||||||
@@ -2933,9 +2938,8 @@ var mainRender = function (cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// replace route
|
// replace route
|
||||||
route = '/' + route;
|
if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
|
||||||
if (OPTIONS.alias && OPTIONS.alias[route]) {
|
route = getAlias('/' + route);
|
||||||
route = getAlias(route);
|
|
||||||
} else {
|
} else {
|
||||||
route = (OPTIONS.basePath + route).replace(/\/+/, '/');
|
route = (OPTIONS.basePath + route).replace(/\/+/, '/');
|
||||||
}
|
}
|
||||||
@@ -2991,6 +2995,7 @@ var Docsify = function () {
|
|||||||
mainRender(function (_) {
|
mainRender(function (_) {
|
||||||
scrollIntoView();
|
scrollIntoView();
|
||||||
activeLink('nav');
|
activeLink('nav');
|
||||||
|
window.Docsify.hook.emit('doneEach');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
@@ -290,7 +290,7 @@ var install = function () {
|
|||||||
new SearchComponent();
|
new SearchComponent();
|
||||||
!isAuto && searchPlugin();
|
!isAuto && searchPlugin();
|
||||||
});
|
});
|
||||||
isAuto && hook.beforeEach(searchPlugin);
|
isAuto && hook.doneEach(searchPlugin);
|
||||||
}, window.$docsify.plugins);
|
}, window.$docsify.plugins);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "docsify",
|
"name": "docsify",
|
||||||
"version": "2.3.0",
|
"version": "2.4.2",
|
||||||
"description": "A magical documentation generator.",
|
"description": "A magical documentation generator.",
|
||||||
"main": "lib/docsify.js",
|
"main": "lib/docsify.js",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export default class Hook {
|
|||||||
this.afterHooks = []
|
this.afterHooks = []
|
||||||
this.initHooks = []
|
this.initHooks = []
|
||||||
this.readyHooks = []
|
this.readyHooks = []
|
||||||
|
this.doneEachHooks = []
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach (fn) {
|
beforeEach (fn) {
|
||||||
@@ -14,6 +15,10 @@ export default class Hook {
|
|||||||
this.afterHooks.push(fn)
|
this.afterHooks.push(fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doneEach (fn) {
|
||||||
|
this.doneEachHooks.push(fn)
|
||||||
|
}
|
||||||
|
|
||||||
init (fn) {
|
init (fn) {
|
||||||
this.initHooks.push(fn)
|
this.initHooks.push(fn)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -72,9 +72,8 @@ const mainRender = function (cb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// replace route
|
// replace route
|
||||||
route = '/' + route
|
if (OPTIONS.alias && OPTIONS.alias['/' + route]) {
|
||||||
if (OPTIONS.alias && OPTIONS.alias[route]) {
|
route = getAlias('/' + route)
|
||||||
route = getAlias(route)
|
|
||||||
} else {
|
} else {
|
||||||
route = (OPTIONS.basePath + route).replace(/\/+/, '/')
|
route = (OPTIONS.basePath + route).replace(/\/+/, '/')
|
||||||
}
|
}
|
||||||
@@ -130,6 +129,7 @@ const Docsify = function () {
|
|||||||
mainRender(_ => {
|
mainRender(_ => {
|
||||||
scrollIntoView()
|
scrollIntoView()
|
||||||
activeLink('nav')
|
activeLink('nav')
|
||||||
|
window.Docsify.hook.emit('doneEach')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ const install = function () {
|
|||||||
new SearchComponent()
|
new SearchComponent()
|
||||||
!isAuto && searchPlugin()
|
!isAuto && searchPlugin()
|
||||||
})
|
})
|
||||||
isAuto && hook.beforeEach(searchPlugin)
|
isAuto && hook.doneEach(searchPlugin)
|
||||||
}, window.$docsify.plugins)
|
}, window.$docsify.plugins)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user