Skip to content

Commit c888003

Browse files
committed
feat: multi detector runs, related to #1807
1 parent 107589b commit c888003

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/shell-chrome/src/detector.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ window.addEventListener('message', e => {
88
})
99

1010
function detect (win) {
11-
setTimeout(() => {
11+
let delay = 1000
12+
let detectRemainingTries = 10
13+
14+
function runDetect () {
1215
// Method 1: Check Nuxt.js
1316
const nuxtDetected = !!(window.__NUXT__ || window.$nuxt)
1417

@@ -58,7 +61,20 @@ function detect (win) {
5861
devtoolsEnabled: Vue.config.devtools,
5962
vueDetected: true,
6063
}, '*')
64+
return
65+
}
66+
67+
if (detectRemainingTries > 0) {
68+
detectRemainingTries--
69+
setTimeout(() => {
70+
runDetect()
71+
}, delay)
72+
delay *= 5
6173
}
74+
}
75+
76+
setTimeout(() => {
77+
runDetect()
6278
}, 100)
6379
}
6480

0 commit comments

Comments
 (0)