/** * @callback Exit * Exit function. * @returns {void} */ /** * @callback Enter * Enter function. * @returns {Exit} * Exit function. */ /** * Create a toggle, which when entering toggles `key` on `ctx` (or `this`, if * `ctx` is not given) to `!initial`, and when exiting, sets `key` on the * context back to the value it had before entering. * * @param {string} key * Key to toggle * @param {boolean} state * Default state. * @param {Record} [ctx] * Record to toggle on (default: `this` of `enter`). * @returns {Enter} * Enter function. */ export function stateToggle( key: string, state: boolean, ctx?: Record | undefined ): Enter /** * Exit function. */ export type Exit = () => void /** * Enter function. */ export type Enter = () => Exit