Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created March 23, 2022 07:11
Show Gist options
  • Save NetanelBasal/73985f968da3d95ee6fcfa6fbf2fe3a7 to your computer and use it in GitHub Desktop.
Save NetanelBasal/73985f968da3d95ee6fcfa6fbf2fe3a7 to your computer and use it in GitHub Desktop.
@Injectable({ providedIn: 'root' })
export class OfflineService {
constructor(private toast: HotToastService) {
fromEvent(window, 'offline').pipe(
tap(() =>
this.toast.warning('There is no internet connection', {
duration: 10_000,
})
)
).subscribe()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment