{"version":"2.1.271","anchor":"new-clock-plugin-api-nowsleepafterevery","canonical_anchor":"new-plugin-ui-focusscroll-api-uifocus-uiscroll","heading":"Plugins gain new UI focus\/scroll and clock capabilities","tier":"use","area":"Plugin API","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.271\/e\/new-clock-plugin-api-nowsleepafterevery","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.271","markdown":"### Plugins gain new UI focus\/scroll and clock capabilities\n\nPlugins can now request keyboard focus and scroll position in their UI, plus use new clock.now\/sleep\/after\/every timer functions\n\n**What**\n\n- New `ui.focus` and `ui.scroll` hook events let a plugin request or commit keyboard focus onto an element it drew, and move or reveal scroll position within a transcript or pane it owns, with ownership checks so one plugin can't steal focus or scroll from another plugin's UI, and tracking of whether a person or the plugin itself initiated the action.\n\n- The plugin-facing `$.ui` object gains `ui.scroll` (with `to`\/`in`\/`block` options) and `ui.focus` (with `requestId`\/`key`), plus new `closeOnEscape`, `holdToasts`, and `rows` options on `ui.open`. A third new event, `ui.blit`, was also registered in the event-type system.\n\n- A new `$.clock` plugin API adds `now()`, `sleep(ms)`, `after(ms, fn)`, and `every(ms, fn)`, each validated to require non-negative millisecond counts and wired through cancellation\/abort signals.\n\n**Why** These additions give plugins finer control over their own UI (focus and scrolling, without interfering with other plugins) and a built-in way to schedule timed or repeating work, instead of needing to work around the host for either.\n\n- Area: Plugin API\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 3\/5"}