Skip to content

Commit

Permalink
docs: Add missing tsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alorel committed Jul 16, 2019
1 parent 704f9bf commit a6868c4
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/_driver.ts
@@ -1 +1,2 @@
/** Driver name */
export const _driver = 'localforage-driver-memory';
4 changes: 4 additions & 0 deletions src/_initStorage.ts
@@ -1,6 +1,10 @@
import {clone, getKeyPrefix, LocalForageOptions, serialiser} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Initialiser function for this storage engine
* @param options Initialisation config
*/
export function _initStorage(this: any, options?: LocalForageOptions): any {
const opts = options ? clone(options) : {};
const kp = getKeyPrefix(opts, this._defaultConfig);
Expand Down
4 changes: 4 additions & 0 deletions src/clear.ts
@@ -1,6 +1,10 @@
import {executeCallback} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Clear all items from storage
* @param callback Callback for when the operation completes
*/
export function clear(this: any, callback?: (err: any) => void): Promise<void> {
const promise = this.ready().then(() => {
(<Store>this._dbInfo.mStore).clear();
Expand Down
5 changes: 5 additions & 0 deletions src/dropInstance.ts
@@ -1,6 +1,11 @@
import {dropInstanceCommon, executeCallback} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Drop the storage instance
* @param _options Drop options
* @param _cb Callback to execute when the operation completes
*/
export function dropInstance(this: any, _options: any, _cb?: any) {
const {promise, callback} = dropInstanceCommon.apply(this, <any>arguments);

Expand Down
5 changes: 5 additions & 0 deletions src/getItem.ts
@@ -1,6 +1,11 @@
import {executeCallback, normaliseKey} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Get item from storage
* @param key$ Item key
* @param callback Callback for when the operation completes
*/
export function getItem(this: any, key$: string, callback?: any) {
key$ = normaliseKey(key$);

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
@@ -1,3 +1,4 @@
/** An indicator that this driver is supported (all browsers will support it) */
export const _support = true;
export {_driver} from './_driver';
export {_initStorage} from './_initStorage';
Expand Down
5 changes: 5 additions & 0 deletions src/iterate.ts
@@ -1,6 +1,11 @@
import {executeCallback} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Iterate over key/value pairs
* @param iterator Iterator function
* @param callback Callback for when the operation completes
*/
export function iterate(this: any, iterator: any, callback?: any) {
const promise = this.ready().then(() => {
const store = (<Store>this._dbInfo.mStore);
Expand Down
5 changes: 5 additions & 0 deletions src/key.ts
@@ -1,6 +1,11 @@
import {executeCallback} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Get a key at the specified index from storage
* @param idx The index
* @param callback Callback for when the operation completes
*/
export function key(this: any, idx: number, callback?: any) {
const promise = this.ready().then(() => {
let result: any;
Expand Down
4 changes: 4 additions & 0 deletions src/keys.ts
@@ -1,6 +1,10 @@
import {executeCallback} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* List keys in storage
* @param callback Callback for when the operation completes
*/
export function keys(this: any, callback?: any) {
const promise = this.ready().then(() => {
return (<Store>this._dbInfo.mStore).keys();
Expand Down
4 changes: 4 additions & 0 deletions src/length.ts
@@ -1,5 +1,9 @@
import {executeCallback} from 'localforage-driver-commons';

/**
* Return the number of items in storage
* @param callback Callback for when the operation completes
*/
export function length(this: any, callback?: any) {
const promise = this.keys().then((keys$: any[]) => keys$.length);

Expand Down
5 changes: 5 additions & 0 deletions src/removeItem.ts
@@ -1,6 +1,11 @@
import {executeCallback, normaliseKey} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Remove item from storage
* @param key$ Item key
* @param callback Callback for when the operation completes
*/
export function removeItem(this: any, key$: string, callback?: any) {
key$ = normaliseKey(key$);

Expand Down
6 changes: 6 additions & 0 deletions src/setItem.ts
@@ -1,6 +1,12 @@
import {executeCallback, normaliseKey} from 'localforage-driver-commons';
import {Store} from './Store';

/**
* Set the item in storage
* @param key$ Item key
* @param value Item value
* @param callback callback for when the operation completes
*/
export function setItem(this: any, key$: string, value: any, callback?: any) {
key$ = normaliseKey(key$);

Expand Down
5 changes: 3 additions & 2 deletions test/tslint.json
Expand Up @@ -2,6 +2,7 @@
"extends": "../tslint.json",
"rules": {
"no-unused-expression": false,
"no-magic-numbers": false
"no-magic-numbers": false,
"completed-docs": false
}
}
}

0 comments on commit a6868c4

Please sign in to comment.