Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-ts latest

Selection.one

The single member, or the single one matching criteria.

Source and package
Qualified name
Selection.one
Module
selection
Declared in
Selection
Package
libtmux
Source
packages/libtmux/src/selection.ts

Description#

Throws NoMatchError for none and MultipleMatchesError for several, so "exactly one" is enforced rather than assumed — a first() that silently takes the head of two is how the wrong pane gets driven.

An id is not always one member. A window linked into two sessions, or shared by two grouped sessions, has a placement in each and both carry the same id, so one({ id }) raises for a perfectly good id. Add the session to say which placement is meant.

Examples#

const only = snapshot.sessions.one({ name: "work" });
only.id;
Type parameters
Parameters

Guides#

Pages that discuss one.

Esc

Type to search.

Reference previewOpen reference