fix(Pjax): 增加错误处理以防止Pjax失效

This commit is contained in:
DeepChirp committed 2025-09-05 23:43:14 +08:00 Unverified
1 parent fcd760011a
commit c61f55a773
1 file changed
+7 -1
+7 -1
View File
@@ -29,7 +29,13 @@ script.
const triggerPjaxFn = (val) => { const triggerPjaxFn = (val) => {
if (!val) return if (!val) return
Object.values(val).forEach(fn => fn()) Object.values(val).forEach(fn => {
try {
fn()
} catch (err) {
console.debug('Pjax callback failed:', err)
}
})
} }
document.addEventListener('pjax:send', () => { document.addEventListener('pjax:send', () => {