Skip to content

Commit

Permalink
Fixed typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
pklaschka committed Jun 9, 2019
1 parent bc1564a commit 57a9da8
Showing 1 changed file with 36 additions and 35 deletions.
71 changes: 36 additions & 35 deletions storage-helper.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,46 @@
*/

/**
* The xd-storage-helper module
* @module xd-storage-helper
* @desc The storage helper module
*/
declare module 'xd-storage-helper' {

/**
* @class StorageHelper
* The main LocalizationHelper class
* @alias module:xd-storage-helper
* @static
* @hideconstructor
*/
declare class StorageHelper {
/**
* Retrieves a value from storage. Saves default value if none is set.
* @param {string} key The identifier
* @param {*} defaultValue The default value. Gets saved and returned if no value was previously set for the speciefied key.
* @return {Promise<*>} The value retrieved from storage. If none is saved, the `defaultValue` is returned.
*/
public static get(key: string, defaultValue: any): Promise<any>;

/**
* @class StorageHelper
* The main LocalizationHelper class
* @alias module:xd-storage-helper
* @static
* @hideconstructor
* Saves a certain key-value-pair to the storage.
* @param {string} key The identifier
* @param {*} value The value that get's saved
* @return {Promise<void>}
*/
export default class StorageHelper {
/**
* Retrieves a value from storage. Saves default value if none is set.
* @param {string} key The identifier
* @param {*} defaultValue The default value. Gets saved and returned if no value was previously set for the speciefied key.
* @return {Promise<*>} The value retrieved from storage. If none is saved, the `defaultValue` is returned.
*/
public static get(key:string, defaultValue:any): Promise<any>;
public static set(key: string, value: any): Promise<void>;

/**
* Saves a certain key-value-pair to the storage.
* @param {string} key The identifier
* @param {*} value The value that get's saved
* @return {Promise<void>}
*/
public static set(key: string, value:any): Promise<void>;
/**
* Deletes a certain key-value-pair from the storage
* @param {string} key The key of the deleted pair
* @return {Promise<void>}
*/
public static delete(key: string): Promise<void>;

/**
* Deletes a certain key-value-pair from the storage
* @param {string} key The key of the deleted pair
* @return {Promise<void>}
*/
public static delete(key: string): Promise<void>;
/**
* Resets (i.e. purges) all stored settings.
* @returns {Promise<void>}
*/
public static reset(): Promise<void>;
}

/**
* Resets (i.e. purges) all stored settings.
* @returns {Promise<void>}
*/
public static reset(): Promise<void>;
}
}
export = StorageHelper;

0 comments on commit 57a9da8

Please sign in to comment.