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
| Name | Type | Default | Description |
|---|---|---|---|
id | string | — | Id of the detached glass to remove. |
options.animate | boolean | true | Whether 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
- Detached glass — the concept
- addDetachedGlass