dataStorage.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Class for storing data to local storage if available or in-memory storage otherwise
  3. */
  4. export declare class DataStorage {
  5. private static _Storage;
  6. private static _GetStorage;
  7. /**
  8. * Reads a string from the data storage
  9. * @param key The key to read
  10. * @param defaultValue The value if the key doesn't exist
  11. * @returns The string value
  12. */
  13. static ReadString(key: string, defaultValue: string): string;
  14. /**
  15. * Writes a string to the data storage
  16. * @param key The key to write
  17. * @param value The value to write
  18. */
  19. static WriteString(key: string, value: string): void;
  20. /**
  21. * Reads a boolean from the data storage
  22. * @param key The key to read
  23. * @param defaultValue The value if the key doesn't exist
  24. * @returns The boolean value
  25. */
  26. static ReadBoolean(key: string, defaultValue: boolean): boolean;
  27. /**
  28. * Writes a boolean to the data storage
  29. * @param key The key to write
  30. * @param value The value to write
  31. */
  32. static WriteBoolean(key: string, value: boolean): void;
  33. /**
  34. * Reads a number from the data storage
  35. * @param key The key to read
  36. * @param defaultValue The value if the key doesn't exist
  37. * @returns The number value
  38. */
  39. static ReadNumber(key: string, defaultValue: number): number;
  40. /**
  41. * Writes a number to the data storage
  42. * @param key The key to write
  43. * @param value The value to write
  44. */
  45. static WriteNumber(key: string, value: number): void;
  46. }