Files
start-os/sdk/base/lib/util/GetHostInfo.ts
Aiden McClelland 76de6be7de refactor: extract Watchable<T> base class for SDK effect wrappers
Eliminates boilerplate across 7 wrapper classes (GetContainerIp,
GetHostInfo, GetOutboundGateway, GetServiceManifest, GetSslCertificate,
GetStatus, GetSystemSmtp) by moving shared const/once/watch/onChange/
waitFor logic into an abstract Watchable<T> base class.
2026-03-09 15:54:02 -06:00

19 lines
477 B
TypeScript

import { Effects } from '../Effects'
import { Host, HostId, PackageId } from '../osBindings'
import { Watchable } from './Watchable'
export class GetHostInfo extends Watchable<Host | null> {
protected readonly label = 'GetHostInfo'
constructor(
effects: Effects,
readonly opts: { hostId: HostId; packageId?: PackageId },
) {
super(effects)
}
protected call(callback?: () => void) {
return this.effects.getHostInfo({ ...this.opts, callback })
}
}