fix(core): update
This commit is contained in:
parent
d4401172e6
commit
68ac5e6ec2
@ -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 () => {
|
||||||
|
@ -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'
|
||||||
}
|
}
|
||||||
|
11
ts/index.ts
11
ts/index.ts
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user