/** * When using SSR, only graph node ids should be generated (via * `generateNodeId`). It is okay for AtomSelector ids to be generated during * SSR, but id'd selectors won't be hydratable on the client since those ids are * not generated predictably (selectors shouldn't be hydrated anyway). Ecosystem * ids must be set manually. */ export declare class IdGenerator { idCounter: number; /** * Cache function and class instance references that get passed as params to * atoms or AtomSelectors. Map them to a unique, serializable id. Use a * WeakMap so we don't hold on to anything here */ weakCache: WeakMap; /** * Generate an id that is guaranteed to be unique in this ecosystem and * pretty-much-guaranteed to be unique globally. * * This method and `IdGenerator#now()` are the only methods in Zedux that * produce random values. * * Override these when testing to create reproducible graphs/dehydrations that * can be used easily in snapshot testing. See our setup in the Zedux repo at * `/packages/react/test/utils/ecosystem.ts` for an example. */ generateId: (prefix: string) => string; generateNodeId(): string; /** * Turn an array of anything into a predictable string. If any item is an atom * instance, it will be serialized as the instance's id. If * acceptComplexParams is true, map class instances and functions to a * consistent id for the reference. * * Note that recursive objects are not supported - they would add way too much * overhead here and are really just unnecessary. */ hashParams(params: any[], acceptComplexParams?: boolean): string; /** * Generate a timestamp. Pass true to make it a high res timestamp if possible * * This method and `IdGenerator#generateId()` are the only methods in Zedux * that produce random values. * * Override these when testing to create reproducible graphs/dehydrations that * can be used easily in snapshot testing. See our setup in the Zedux repo at * `/packages/react/test/utils/ecosystem.ts` for an example. */ now(highRes?: boolean): number; private cacheClass; private cacheFn; }