Remove React
This commit is contained in:
@@ -1 +0,0 @@
|
||||
<p>donator-box works!</p>
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DonatorBoxComponent } from './donator-box.component';
|
||||
|
||||
describe('DonatorBoxComponent', () => {
|
||||
let component: DonatorBoxComponent;
|
||||
let fixture: ComponentFixture<DonatorBoxComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [DonatorBoxComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(DonatorBoxComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-donator-box',
|
||||
standalone: true,
|
||||
imports: [CommonModule],
|
||||
templateUrl: './donator-box.component.html',
|
||||
styleUrl: './donator-box.component.scss'
|
||||
})
|
||||
export class DonatorBoxComponent {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Observable, Observer, Subject} from 'rxjs';
|
||||
import {observable, Observable, Observer, Subject} from 'rxjs';
|
||||
import { WSMessage } from '../app/models/WSMessage';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -11,6 +11,9 @@ export class WebsocketService {
|
||||
|
||||
public Messages: Subject<WSMessage>
|
||||
|
||||
|
||||
trydelay = function(ms:number) { new Promise(res => setTimeout(res, ms));}
|
||||
|
||||
constructor() {
|
||||
this.connect();
|
||||
this.Messages = new Subject<WSMessage>();
|
||||
@@ -20,7 +23,7 @@ export class WebsocketService {
|
||||
return !this.isConnected;
|
||||
}
|
||||
connect(){
|
||||
this.socket = new WebSocket('ws://localhost:5000/notify');
|
||||
this.socket = new WebSocket('ws://localhost:5000/notify');
|
||||
|
||||
this.socket.onopen = () => {
|
||||
this.isConnected = true;
|
||||
@@ -46,5 +49,17 @@ export class WebsocketService {
|
||||
console.log("Connection");
|
||||
}
|
||||
|
||||
async reconnect(){
|
||||
while(!this.isConnected){
|
||||
try{
|
||||
this.connect();
|
||||
await this.trydelay(5000);
|
||||
|
||||
}
|
||||
catch{
|
||||
console.log("Retrying");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user