Improving all side of app
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { writable, type Readable } from './store';
|
||||
import { writeLocalState } from './localstate';
|
||||
import { pushControlDialog } from './controldialogs';
|
||||
import type { SignalRef, SignalValue, SignalMeta, HistoryPoint } from './types';
|
||||
|
||||
// ── Types ────────────────────────────────────────────────────────────────────
|
||||
@@ -163,6 +164,16 @@ class WsClient {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'dialog': {
|
||||
// Server-side control logic requesting a user notification / input.
|
||||
pushControlDialog({
|
||||
id: String(msg.id),
|
||||
kind: msg.kind === 'error' || msg.kind === 'input' ? msg.kind : 'info',
|
||||
title: msg.title,
|
||||
message: msg.message,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'error':
|
||||
// Resolve any pending history callbacks with empty data on error
|
||||
if (key && this.histCallbacks.has(key)) {
|
||||
@@ -270,6 +281,14 @@ class WsClient {
|
||||
console.log('[ws] write', ref.ds, ref.name, value, 'ws state:', this.ws?.readyState);
|
||||
this._send({ type: 'write', ds: ref.ds, name: ref.name, value });
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer a control-logic input dialog. `value === null` cancels (dismisses)
|
||||
* the dialog without writing its target server variable.
|
||||
*/
|
||||
sendDialogResponse(id: string, value: number | null): void {
|
||||
this._send({ type: 'dialogResponse', id, value });
|
||||
}
|
||||
}
|
||||
|
||||
// Singleton instance
|
||||
|
||||
Reference in New Issue
Block a user