/** * @typedef {object} Storage * @property {function(string):*} get Gets value for property. * @property {function(string, *):undefined} set Sets value, or intercepted value if exists, for property and triggers onChanged listener. * @property {function(string, *):undefined} preventSet Sets value while ignoring interceptor and skips triggering onChanged listener. * @property {function(string, function):undefined} intercept Adds interceptor for property. * @property {function(string, function):undefined} onChanged Adds onChanged listener for property. */ /** * Creates a storage instance. * * @param {object} properties Properties and their default values to set. * * @returns {Storage} Storage instance. * * @example * * const storage = createStorage({ value: 10 }); * storage.get('value'); * // => 10 */ export default function createStorage(properties: object): Storage; export type Storage = { /** * Gets value for property. */ get: (arg0: string) => any; /** * Sets value, or intercepted value if exists, for property and triggers onChanged listener. */ set: (arg0: string, arg1: any) => undefined; /** * Sets value while ignoring interceptor and skips triggering onChanged listener. */ preventSet: (arg0: string, arg1: any) => undefined; /** * Adds interceptor for property. */ intercept: (arg0: string, arg1: Function) => undefined; /** * Adds onChanged listener for property. */ onChanged: (arg0: string, arg1: Function) => undefined; };