fix: add help to launch 1 single server

This commit is contained in:
pelikhan 2023-02-22 11:54:26 -08:00
Родитель 6519fcad21
Коммит e969131d15
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -1892,6 +1892,32 @@ export function addServiceProvider(
return d
}
/**
* Adds a single server device on the bus.
* @param bus
* @param name
* @param server
* @param serviceOptions
* @returns
*/
export function addServer(
bus: JDBus,
name: string,
server: JDServiceServer,
serviceOptions?: ServiceProviderOptions[]
) {
const services = [server]
return addServiceProvider(
bus,
{
name,
serviceClasses: services.map(srv => srv.serviceClass),
services: () => services,
},
serviceOptions
)
}
/**
* Finds the first service provider that supports the given service class
* @category Servers