UNPKG

@keybindy/core

Version:

A lightweight and framework-agnostic keyboard shortcut manager for web apps. Define, register, and handle keybindings with ease.

45 lines (44 loc) 1.19 kB
export declare class ScopeManager { private scopeStack; /** * Pushes a new scope onto the scope stack. * @param scope - The scope to push. */ pushScope(scope: string): void; /** * Pops the last scope from the scope stack. */ popScope(): void; /** * Swaps the active scope with the scope at the given index. * @param scope - The scope to swap. * @param index - The index of the scope to swap. * @private */ private swap; /** * Activates the scope at the given index. * @param scope - The scope to activate. */ setActiveScope(scope: string): void; /** * Resets the scope stack to the default state. */ resetScope(): void; /** * Returns the active scope. * @returns The active scope. */ getActiveScope(): string; /** * Checks if the given scope is active. * @param scope - The scope to check. * @returns `true` if the scope is active, `false` otherwise. */ isScopeActive(scope?: string): boolean; /** * Returns all scopes in the stack. * @returns An array of scopes. */ getScopes(): string[]; }