fix(core): update

This commit is contained in:
Philipp Kunz 2023-06-10 16:43:20 +02:00
parent d4401172e6
commit 68ac5e6ec2
3 changed files with 11 additions and 3 deletions

View File

@ -19,6 +19,7 @@ tap.test('should be online', async () => {
testWebDetector.onlineObservable.subscribe((state) => { testWebDetector.onlineObservable.subscribe((state) => {
console.log(state); console.log(state);
}); });
testWebDetector.stopPeriodicChecks();
}); });
tap.test('should detect the platform', async () => { tap.test('should detect the platform', async () => {

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/webdetector', name: '@pushrocks/webdetector',
version: '2.0.1', version: '2.0.2',
description: 'detect different environments within the browser' description: 'detect different environments within the browser'
} }

View File

@ -53,10 +53,17 @@ export class WebDetector {
return reachesInternet; return reachesInternet;
} }
async startPeriodicChecks() { private periodicChecksRunning = false;
while (true) {
public async startPeriodicChecks() {
this.periodicChecksRunning = true;
while (this.periodicChecksRunning) {
await this.isOnline(); await this.isOnline();
await plugins.smartdelay.delayFor(3000); await plugins.smartdelay.delayFor(3000);
} }
} }
public async stopPeriodicChecks() {
this.periodicChecksRunning = false;
}
} }