@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
34 lines (33 loc) • 1.15 kB
TypeScript
export interface HistoryOptions {
path?: string;
search?: URLSearchParams | {
[key: string]: unknown;
};
hash?: string;
}
/**
* Transform an object to an URLSearchParams instance.
*
* @param {Object} obj The object to convert.
* @param {string} defaultSearch A string of defaults search params.
* @returns {URLSearchParams}
*/
export declare function objectToURLSearchParams(obj: unknown, defaultSearch?: string): URLSearchParams;
/**
* Push a new state.
*
* @param {HistoryOptions} options The new state.
* @param {Object} [data] The data for the new state.
* @param {string} [title] The title for the new state.
* @returns {void}
*/
export declare function push(options: HistoryOptions, data?: unknown, title?: string): void;
/**
* Replace a new state.
*
* @param {HistoryOptions} options The new state.
* @param {Object} [data] The data for the new state.
* @param {string} [title] The title for the new state.
* @returns {void}
*/
export declare function replace(options: HistoryOptions, data?: unknown, title?: string): void;