canti primo tag
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { Injectable, signal } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ConnectivityService {
|
||||
public isOnline = signal<boolean>(navigator.onLine);
|
||||
|
||||
constructor() {
|
||||
window.addEventListener('online', () => this.isOnline.set(true));
|
||||
window.addEventListener('offline', () => this.isOnline.set(false));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user