Server.withConnection
Run body against a connected server, closing it afterwards.
Source and package
- Qualified name
-
Server.with Connection - Module
- server
- Declared in
Server- Package
- libtmux
- Source
- packages/libtmux/src/server.ts
-
Description#
The scoped form of
connect(), for code that cannot useawait using— it needsSymbol.asyncDisposein the consumer'slib— or would rather not manage the lifetime by hand. The connection closes on the way out whetherbodyreturns or throws.Examples#
const opened = await server.withConnection(async (live) => {await session.newWindow({ name: "build" });return live.waitFor((current) => current.windows.exists({ name: "build" }));});opened.windows.count({ name: "build" }); // 1- Type parameters
- Parameters
-
-
body((live: ConnectedServer ) => Promise<T>) #
-