UNPKG

@tanstack/hotkeys

Version:

Type-safe, framework-agnostic keyboard hotkey management for the browser

12 lines (11 loc) • 569 B
// src/_app-hotkeys-factory.ts let factory; function setAppHotkeysStoreFactory(create) { factory = create; } /** Creates the store for app hotkeys from `defineAppHotkeys`. */ function createAppHotkeysStore(appHotkeys, options) { if (!factory) throw new Error("[hotkeys] defineAppHotkeys did not run in this bundle. Import the app hotkeys in the module that renders the provider. With React Server Components, render AppHotkeysProvider instead of HotkeysProvider."); return factory(appHotkeys, options); } export { createAppHotkeysStore, setAppHotkeysStoreFactory };