Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

useDesktopClick

Calls a handler when a file is clicked.

import { useDesktopClick } from 'filedom';

useDesktopClick(path, () => selectPiece());

The handler fires when the user clicks the file at path without dragging it. Finder’s selection does the hit-testing, so no geometry is needed.

Parameters

useDesktopClick(
  path: string | undefined,
  onClick?: (() => void)
)

path: filesystem path to watch. Undefined disables the subscription.

onClick: optional handler. Omit it to disable the subscription.

Returns

Nothing (void).

Was this page helpful?