diff --git a/ReadMe.md b/ReadMe.md index df7ab76..5542060 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -145,6 +145,15 @@ It will be called after the blog is decrypted. Demo: [Callback Example](https://mhexo.github.io/2020/12/06/Callback-Test/). +### After Decrypt Event +Thanks to @[f-dong](https://github.com/f-dong), we now will trigger a event named `hexo-blog-decrypt`, so you can add a call back to listen to that event. + +``` +// trigger event +var event = new Event('hexo-blog-decrypt'); +window.dispatchEvent(event); +``` + ### Encrypt TOC If you has a post with TOC, you should change the code of your template. Take the default theme 'landscape' as an example: diff --git a/ReadMe.zh.md b/ReadMe.zh.md index 37d0d6e..6718f49 100644 --- a/ReadMe.zh.md +++ b/ReadMe.zh.md @@ -151,6 +151,15 @@ It will be called after the blog decrypted. 例子在: [Callback 例子](https://mhexo.github.io/2020/12/06/Callback-Test/). +### 解密后的触发事件 +感谢 @[f-dong](https://github.com/f-dong), 我们现在会在解密完成后触发一个 `hexo-blog-decrypt` 事件, 你们可以编写 callback 来监听该事件. + +``` +// trigger event +var event = new Event('hexo-blog-decrypt'); +window.dispatchEvent(event); +``` + ### 对 TOC 进行加密 如果你有一篇文章使用了 TOC,你需要修改模板的部分代码。这里用 landscape 作为例子: diff --git a/package.json b/package.json index 4dab881..f5bea09 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "test": "echo \"Error: no test specified\" && exit 1", "lint": "eslint --ext .js ./" }, - "version": "3.1.6", + "version": "3.1.8", "devDependencies": { "eslint": "^6.2.2" }