Optionalviewer: ThreeViewerThe keys run the actions. Off: no key runs an action (run still does).
Show the error and the warn of each run of an action in a toast (viewer.dialog.toast)
ReadonlyuiFor a settings panel: the keys on or off, the toasts on or off, and a button for each action with its key
Optional ReadonlyviewerThe viewer, or undefined for actions that are not part of one (they take every key)
Removes the key listeners. Called by the viewer when it is disposed.
The actions, in the order they were registered
Optionalgroup: string
only the actions of this group
Adds actions. An action with the id of a registered one replaces it. A shortcut that does not parse (parseShortcut) is a warning, and its key does nothing.
a function that removes these actions (not an action that replaced one of them later)
Ends one suspend
Runs an action and sends actionRun with its result. An action that throws has the error in its result.
the result, or undefined when there is no such action or it is not enabled (it does not run then)
Changes the key of an action, also of one that is registered later or again. It is the one place where an app sets the keys: another key, more keys, or none.
the id of the action
the key or the keys; null: no key; undefined: the key of the action again
The key or the keys of an action now: the one set with setShortcut, else its own; undefined: no key
Removes the action with this id
The actions of a viewer (
viewer.actions): a registry of ViewerActions, each with an id, a label, an icon, a shortcut, a group,enabled()andrun(). Plugins register their actions and keys once (inonAdded, and remove them inonRemove); any UI (a toolbar, a context menu, a command palette, a sheet of the keys) lists them with list, shows their keys with formatShortcut and runs them with run. Each viewer has one, and it adds no element to the page. Its uiConfig (anActionsfolder: the keys on or off, and the actions with their keys) shows only where an app or a UI adds it.keydownlistener on the window runs the shortcuts of the actions, while it has actions. It leaves a key typed in a text field (an input, a text area, a select, an editable element) and a key that another handler used (defaultPrevented). It callspreventDefaultonly when an action runs. When two enabled actions have the same key, the one with the higher ViewerAction.priority runs, then the one registered last.actionRuntells the result of each run (ViewerActionResult), andactionsChangetells that the list or a key changed. Theerrorand thewarnof a result show in a toast (toastResults,viewer.dialog.toast).<dialog>the keys are also off, without code (suspended).new ViewerActions()), for a UI that is not part of one: it takes every key and shows no toast.Example