fix(core): update

This commit is contained in:
Philipp Kunz 2023-03-31 13:18:23 +02:00
parent d160a92bee
commit 830682d382
5 changed files with 26 additions and 4 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@apiglobal/typedserver',
version: '2.0.44',
version: '2.0.45',
description: 'easy serving of static files'
}

View File

@ -10,3 +10,14 @@ export interface IReq_PushLatestServerChangeTime extends typedrequestInterfaces.
};
response: {}
}
export interface IReq_GetLatestServerChangeTime extends typedrequestInterfaces.implementsTR<
typedrequestInterfaces.ITypedRequest,
IReq_GetLatestServerChangeTime
> {
method: 'getLatestServerChangeTime',
request: {};
response: {
time: number;
}
}

View File

@ -176,6 +176,13 @@ export class TypedServer {
this.server
);
// lets setup typedrouter
this.typedrouter.addTypedHandler<interfaces.IReq_GetLatestServerChangeTime>(new plugins.typedrequest.TypedHandler('getLatestServerChangeTime', async reqDataArg => {
return {
time: this.lastReload,
}
}))
// console.log('open url in browser');
// await plugins.smartopen.openUrl(`http://testing.git.zone:${this.options.port}`);
}

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@apiglobal/typedserver',
version: '2.0.44',
version: '2.0.45',
description: 'easy serving of static files'
}

View File

@ -98,14 +98,18 @@ export class ReloadChecker {
this.typedrouter,
plugins.typedsocket.TypedSocket.useWindowLocationOriginUrl()
);
this.typedsocket.eventSubject.subscribe(eventArg => {
this.typedsocket.eventSubject.subscribe(async eventArg => {
console.log(`typedsocket event subscription: ${eventArg}`);
if (eventArg === 'disconnected' || eventArg === 'disconnecting' || eventArg === 'timedOut') {
this.backendConnectionLost = true;
this.infoscreen.setText(`typedsocket ${eventArg}!`)
} else if (eventArg === 'connected' && this.backendConnectionLost) {
this.backendConnectionLost = false;
this.infoscreen.setSuccess('typedsocket connected!')
this.infoscreen.setSuccess('typedsocket connected!');
// lets check if a reload is necessary
const getLatestServerChangeTime = this.typedsocket.createTypedRequest<interfaces.IReq_GetLatestServerChangeTime>('getLatestServerChangeTime');
const response = await getLatestServerChangeTime.fire({});
this.checkReload(response.time);
}
});