Skip to content

Commit

Permalink
timer
Browse files Browse the repository at this point in the history
  • Loading branch information
bunsenstraat committed Oct 5, 2023
1 parent b4cb32d commit 387e3a5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions apps/remix-ide/src/app/components/preload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { fileSystemUtility, migrationTestData } from '../files/filesystems/fileS
import './styles/preload.css'
const _paq = (window._paq = window._paq || [])

let netWorkTimeToLoad = 0
let netWorkLoadTestTimer = undefined

export const Preload = () => {
Expand All @@ -33,20 +32,18 @@ export const Preload = () => {
)

function startDetectSlowNetwork() {
netWorkLoadTestTimer = setInterval(() => {
netWorkTimeToLoad += 1000
if (netWorkTimeToLoad > 5000) {
netWorkLoadTestTimer = setTimeout(() => {
setSlowNetWorkTimeout(true)
}
}, 1000)
clearTimeout(netWorkLoadTestTimer)
}, 5000)

}

function loadAppComponent() {
startDetectSlowNetwork()
import('../../app')
.then((AppComponent) => {
clearInterval(netWorkLoadTestTimer)
clearTimeout(netWorkLoadTestTimer)
const appComponent = new AppComponent.default()
appComponent.run().then(() => {
render(
Expand Down

0 comments on commit 387e3a5

Please sign in to comment.