WIP new websocket setup; build setup changes; types cleanup
This commit is contained in:
@@ -48,7 +48,6 @@
|
||||
"src/assets/css/ace-overrides.css"
|
||||
],
|
||||
"scripts":[
|
||||
"src/libs/showdown.min.js"
|
||||
],
|
||||
"optimization": true
|
||||
},
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
"electron-start": "electron . --trace-warnings --start-as=build --ipc-port=4588",
|
||||
"electron-pack": "ng build --base-href ./ && electron-builder --dir",
|
||||
"electron-dist": "ng build --base-href ./ && electron-builder",
|
||||
"electron-dist-appimage-linux": "ng build --base-href ./ && electron-builder --linux AppImage",
|
||||
"electron-dist-deb-linux": "ng build --base-href ./ && electron-builder --linux deb",
|
||||
"electron-dist-zip-linux": "ng build --base-href ./ && electron-builder --linux zip",
|
||||
"electron-dist-deb-linux": "ng build --base-href ./ && electron-builder --linux deb",
|
||||
"electron-dist-appimage-linux": "ng build --base-href ./ && electron-builder --linux AppImage",
|
||||
"electron-dist-all-linux": "ng build --base-href ./ && electron-builder --linux deb zip AppImage",
|
||||
"electron-dist-all": "ng build --base-href ./ && electron-builder -mwl",
|
||||
"electron-concurrently": "concurrently 'ng serve' 'electron . --trace-warnings --start-as=ng-serve'",
|
||||
"ng-serve": "ng serve",
|
||||
"ng-build": "ng build",
|
||||
"ng-build": "ng build --base-href ./",
|
||||
"ng-watch-build": "ng build --watch --configuration development",
|
||||
"ng-test": "ng test",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject } from '@angular/core';
|
||||
|
||||
import { WebsocketService } from './common/services/websocket.service';
|
||||
|
||||
import { InfoBarComponent } from './editor/info-bar/info-bar.component';
|
||||
import { TabsComponent } from './editor/tabs/tabs.component';
|
||||
@@ -28,6 +30,17 @@ import { LspManagerComponent } from "./editor/lsp-manager/lsp-manager.component"
|
||||
export class AppComponent {
|
||||
title = 'Newton';
|
||||
|
||||
protected ws: WebsocketService = inject(WebsocketService);
|
||||
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {
|
||||
// TODO: Set with dynamic address and port
|
||||
this.ws.connect('ws://localhost:7272').subscribe(msg => {
|
||||
console.log(msg);
|
||||
// this.ws.send("{ 'text': 'Hello server!' }");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
35
src/app/common/services/websocket.service.ts
Normal file
35
src/app/common/services/websocket.service.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { webSocket, WebSocketSubject } from 'rxjs/webSocket';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WebsocketService {
|
||||
|
||||
private socket$!: WebSocketSubject<any>;
|
||||
|
||||
connect(url: string): Observable<any> {
|
||||
if (!this.socket$ || this.socket$.closed) {
|
||||
this.socket$ = webSocket(
|
||||
{
|
||||
url,
|
||||
deserializer: msg => msg.data
|
||||
}
|
||||
);
|
||||
}
|
||||
return this.socket$.asObservable();
|
||||
}
|
||||
|
||||
send(message: any) {
|
||||
if (this.socket$) {
|
||||
this.socket$.next(message);
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
if (this.socket$) {
|
||||
this.socket$.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
3
src/libs/showdown.min.js
vendored
3
src/libs/showdown.min.js
vendored
File diff suppressed because one or more lines are too long
1
src/typings.d.ts
vendored
1
src/typings.d.ts
vendored
@@ -1 +0,0 @@
|
||||
// declare var showdown: any;
|
||||
@@ -16,50 +16,6 @@
|
||||
"declaration": false,
|
||||
"skipLibCheck": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
},
|
||||
"includes": [
|
||||
"src/typings.d.ts"
|
||||
]
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"outDir": "./build/app",
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "bundler",
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"useDefineForClassFields": false,
|
||||
"lib": [
|
||||
"ES2022",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
},
|
||||
"includes": [
|
||||
"src/typings.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user