mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Improve
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NetworkService } from './network.service';
|
||||
|
||||
describe('NavigationService', () => {
|
||||
let service: NetworkService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(NetworkService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Network } from '@ionic-native/network/ngx';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { fromEvent, merge, of, Observable } from 'rxjs';
|
||||
import { mapTo } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NetworkService {
|
||||
|
||||
constructor(
|
||||
private network: Network) { }
|
||||
|
||||
checkNetworkConnection(){
|
||||
this.network.onConnect().subscribe((value) => {
|
||||
|
||||
document.body.style.setProperty(`--color`, "#0782C9");
|
||||
|
||||
console.log('network connected!',value);
|
||||
});
|
||||
}
|
||||
|
||||
checkNetworkDisconnection(){
|
||||
this.network.onDisconnect().subscribe((value) => {
|
||||
document.body.style.setProperty(`--color`, "#eeeb30");
|
||||
console.log('network was disconnected :-('),value;
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user