import type { Atom, AtomKey, AtomStore, AtomStoreUpdate, DynamicAtomGetter, DynamicAtomSetter } from './types.js'; /** * Special EventEmitter for state updates. * * @description Precoil is built around an idiomatic asynchronous event-driven * architecture in which setters emits atoms keys named events that cause * listeners to be called with a new state. * * @example * * // Logs state on update atom. * unsafe_updater.on(counterAtom.key, console.log); * * @example * * // Logs state on update atom with `counter` key. * unsafe_updater.on('counter', console.log); * * @see https://github.com/developit/mitt * * @nosideeffects */ export declare const unsafe_updater: import("mitt").Emitter; /** * The source of truth for all created atoms. * * @description It is better to use the atom's method to get the current state. * * @example * * console.log(store.get('counter')); // log: 0 * * @nosideeffects */ export declare const unsafe_store: AtomStore; /** * An atom represents state in precoil. * * @description Atoms contain the source of truth for our application state. * * @template T Atom state type. * * @param defaultValue Initial atom state. * * @param key A unique value that allows you to identify the atom. * * @returns A new atom that lets you read and update its state. * * @example * * const counterAtom = atom(0, 'counter'); * * console.log(counterAtom.get()); // log: 0 * console.log(counterAtom.set(1)); // log: 1 * * @noinline */ export declare const atom: (defaultValue: Value, key?: AtomKey) => Atom; /** * An dynamic atom represents state in precoil. * * @description Dynamic atoms depend on other atoms. * * @template T Dynamic atom state type. * * @param get Function to get states of other atoms. * * @param set Function to set new states to other atoms. * * @param key A unique value that allows you to identify the atom. * * @returns A new dynamic atom that lets you read and update dependent * atoms state. * * @example * * const dynamicCounterAtom = dynamicAtom( * (get) => get(counterAtom), * (get, set, arg) => set(counterAtom, arg), * 'dynamicCount' * ); * * console.log(dynamicCounterAtom.get()); // log: 0 * console.log(dynamicCounterAtom.set(1)); // log: 1 * * @noinline */ export declare const dynamicAtom: (get: (get: DynamicAtomGetter) => Value, set: (get: DynamicAtomGetter, set: DynamicAtomSetter, update: Update) => Value, key?: AtomKey) => Atom;