removeDetachedGlass

Description

Remove a detached glass by its id. Removing an already-removed glass (for example one closed via its own close action) is a no-op, so a stale id is harmless.

binaryWindow.removeDetachedGlass(id, options);

In React, reach removeDetachedGlass through the useWindow hook.

Parameters

NameTypeDefaultDescription
idstringId of the detached glass to remove.
options.animatebooleantrueWhether to play the close animation. Pass false to remove immediately.

Returns

Type: Promise<Element | null>

Description: Resolves to the removed glass element, or null if no glass with that id existed.

Examples

const glassEl = await binaryWindow.addDetachedGlass({ title: 'Panel' });

// later
binaryWindow.removeDetachedGlass(glassEl.id);

// remove immediately, without the close animation
binaryWindow.removeDetachedGlass(glassEl.id, { animate: false });

See also