diff --git a/README.md b/README.md index 7dc24b1..696037e 100644 --- a/README.md +++ b/README.md @@ -281,28 +281,32 @@ Note: If passed as Array, then ratio of the balance of the senders are preserved * Resolves: Object {totalTxs, floData (Array)} ## Compact IndexedDB operations -`compactIDB` operations can be used to perform basic IndexedDB operations such as add, read/write, modify and remove.Contains following operations. +`compactIDB` operations can be used to perform basic IndexedDB operations such as add, read/write, modify and remove. These functions are asynchronous and return a promise. Contains the following operations. #### setDefaultDB compactIDB.setDefaultDB(dbName) `setDefaultDB` sets the database on which further operations will be performed. 1. dbName - This is the name of default database to be used. +* Note: this operation is neither promisified nor returns a value. It just sets the default DB #### initDB compactIDB.initDB(dbName, objectStores = {}) `initDB` initializes new IndexedDB. 1. dbName - Specifies database to be initialized. 2. objectStores - This is an object containing various objectStores to be initiazed when creating an IDB. +* Resolves: Status (string) | Rejects: error #### openDB compactIDB.openDB(dbName = this.defaultDB) `openDB` returns a promise that resolves to a default database object. 1. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: database (IDB) | Rejects: error #### deleteDB compactIDB.deleteDB(dbName = this.defaultDB) `deleteDB` deletes the specified database. 1. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: Status (string) | Rejects: error #### writeData compactIDB.writeData(obsName, data, key = false, dbName = this.defaultDB) @@ -311,6 +315,7 @@ Note: If passed as Array, then ratio of the balance of the senders are preserved 2. data - data that has to be written in specified object store. 3. key - Primary key of the data (optional, false indicates key is autoincremented or passed in data) 4. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: Status (string) | Rejects: error #### addData compactIDB.addData(obsName, data, key = false, dbName = this.defaultDB) @@ -319,6 +324,7 @@ Note: If passed as Array, then ratio of the balance of the senders are preserved 2. data - The data which has to be added to obeject store. 3. key - Primary key of the data (optional, false indicates key is autoincremented or passed in data) 4. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: Status (string) | Rejects: error #### removeData compactDB.removeData(obsName, key, dbName = this.defaultDB) @@ -326,12 +332,14 @@ Note: If passed as Array, then ratio of the balance of the senders are preserved 1. obsName - Name of object store from which the data has to be removed. 2. key - Primary key of the data. 3. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: Status (string) | Rejects: error #### clearData compactDB.clearData(obsName, dbName = this.defaultDB) `clearData` clears all data in the objectStore. 1. obsName - Name of object store from which the data has to be removed. 2. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: Status (string) | Rejects: error #### readData compactDB.readData(obsName, key, dbName = this.defaultDB) @@ -339,12 +347,14 @@ Note: If passed as Array, then ratio of the balance of the senders are preserved 1. obsName - Name of object store from which the data has to be retrieved. 2. key - Primary key of the data to read. 3. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: data (Object) | Rejects: error #### readAllData compactDB.readAllData(obsName, dbName = this.defaultDB) `readAllData` reads all the data from specified object store using IndexedDB openCursor method. 1. obsName - Name of object store from which the data has to be retrieved. 2. dbName - Name of the database (optional, uses defaultDB if not specified) +* Resolves: data (Object) | Rejects: error ## FLO Supernode module This module contains functions that interact with the supernode to send and retrive data in the backend. Use floClouldAPI operations to send and receive data for application. @@ -358,11 +368,13 @@ This module contains functions that interact with the supernode to send and retr 1. message - data to be sent 2. type - type of the data 3. options - (optional, options detailed at end of module) +* Resolves: Sent-Status (string) | Rejects: error #### requestApplicationData floCloudAPI.requestApplicationData(options = {}) `requestApplicationData` requests application data from the cloud. 1. options - (optional, options detailed at end of module) +* Resolves: data (Object) | Rejects: error #### sendGeneralData floCloudAPI.sendGeneralData(message, type, options = {}) @@ -370,12 +382,14 @@ This module contains functions that interact with the supernode to send and retr 1. message - data to be sent 2. type - type of the data 3. options - (optional, options detailed at end of module) +* Resolves: Sent-Status (string) | Rejects: error #### requestGeneralData floCloudAPI.requestGeneralData(type, options = {}) `requestGeneralData` requests application data from the cloud. 1. type - type of the data 2. options - (optional, options detailed at end of module) +* Resolves: Status (string) | Rejects: error #### resetObjectData floCloudAPI.resetObjectData(objectName, options = {}) @@ -383,6 +397,7 @@ This module contains functions that interact with the supernode to send and retr 1. objectName - Name of the objectData to be reset 2. options - (optional, options detailed at end of module) Note: value of objectData is taken from floGlobals +* Resolves: Sent-Status (string) | Rejects: error #### updateObjectData floCloudAPI.updateObjectData(objectName, options = {}) @@ -390,12 +405,14 @@ Note: value of objectData is taken from floGlobals 1. objectName - Name of the objectData to be updated 2. options - (optional, options detailed at end of module) Note: value of objectData is taken from floGlobals +* Resolves: Sent-Status (string) | Rejects: error #### requestObjectData floCloudAPI.requestObjectData(objectName, options = {}) `requestObjectData` requests application data from the cloud. 1. objectName - Name of the objectData to be requested 2. options - (optional, options detailed at end of module) +* Resolves: Status (string) | Rejects: error #### options: * send options: