Skip to content

Commit

Permalink
fix(版本更新): 增加资源加载和异步错误时的版本更新检测
Browse files Browse the repository at this point in the history
  • Loading branch information
hesetiema committed May 25, 2024
1 parent ef02f08 commit 5666026
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,24 @@ router.beforeEach((to, from, next) => {
}
})

window.addEventListener(
'error',
function (e) {
if (e.target) {
checkUpdate()
}
},
true
)

window.addEventListener(
'unhandledrejection',
function (e) {
if (e.target) {
checkUpdate()
}
},
true
)

export default router

0 comments on commit 5666026

Please sign in to comment.