Update README.md

This commit is contained in:
sairajzero 2020-08-05 13:56:12 +05:30
parent f6a07b20ba
commit c3607aa58f

View File

@ -281,28 +281,32 @@ Note: If passed as Array, then ratio of the balance of the senders are preserved
* Resolves: Object {totalTxs, floData (Array)} * Resolves: Object {totalTxs, floData (Array)}
## Compact IndexedDB operations ## 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 #### setDefaultDB
compactIDB.setDefaultDB(dbName) compactIDB.setDefaultDB(dbName)
`setDefaultDB` sets the database on which further operations will be performed. `setDefaultDB` sets the database on which further operations will be performed.
1. dbName - This is the name of default database to be used. 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 #### initDB
compactIDB.initDB(dbName, objectStores = {}) compactIDB.initDB(dbName, objectStores = {})
`initDB` initializes new IndexedDB. `initDB` initializes new IndexedDB.
1. dbName - Specifies database to be initialized. 1. dbName - Specifies database to be initialized.
2. objectStores - This is an object containing various objectStores to be initiazed when creating an IDB. 2. objectStores - This is an object containing various objectStores to be initiazed when creating an IDB.
* Resolves: Status (string) | Rejects: error
#### openDB #### openDB
compactIDB.openDB(dbName = this.defaultDB) compactIDB.openDB(dbName = this.defaultDB)
`openDB` returns a promise that resolves to a default database object. `openDB` returns a promise that resolves to a default database object.
1. dbName - Name of the database (optional, uses defaultDB if not specified) 1. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: database (IDB) | Rejects: error
#### deleteDB #### deleteDB
compactIDB.deleteDB(dbName = this.defaultDB) compactIDB.deleteDB(dbName = this.defaultDB)
`deleteDB` deletes the specified database. `deleteDB` deletes the specified database.
1. dbName - Name of the database (optional, uses defaultDB if not specified) 1. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: Status (string) | Rejects: error
#### writeData #### writeData
compactIDB.writeData(obsName, data, key = false, dbName = this.defaultDB) 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. 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) 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) 4. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: Status (string) | Rejects: error
#### addData #### addData
compactIDB.addData(obsName, data, key = false, dbName = this.defaultDB) 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. 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) 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) 4. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: Status (string) | Rejects: error
#### removeData #### removeData
compactDB.removeData(obsName, key, dbName = this.defaultDB) 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. 1. obsName - Name of object store from which the data has to be removed.
2. key - Primary key of the data. 2. key - Primary key of the data.
3. dbName - Name of the database (optional, uses defaultDB if not specified) 3. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: Status (string) | Rejects: error
#### clearData #### clearData
compactDB.clearData(obsName, dbName = this.defaultDB) compactDB.clearData(obsName, dbName = this.defaultDB)
`clearData` clears all data in the objectStore. `clearData` clears all data in the objectStore.
1. obsName - Name of object store from which the data has to be removed. 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) 2. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: Status (string) | Rejects: error
#### readData #### readData
compactDB.readData(obsName, key, dbName = this.defaultDB) 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. 1. obsName - Name of object store from which the data has to be retrieved.
2. key - Primary key of the data to read. 2. key - Primary key of the data to read.
3. dbName - Name of the database (optional, uses defaultDB if not specified) 3. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: data (Object) | Rejects: error
#### readAllData #### readAllData
compactDB.readAllData(obsName, dbName = this.defaultDB) compactDB.readAllData(obsName, dbName = this.defaultDB)
`readAllData` reads all the data from specified object store using IndexedDB openCursor method. `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. 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) 2. dbName - Name of the database (optional, uses defaultDB if not specified)
* Resolves: data (Object) | Rejects: error
## FLO Supernode module ## 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. 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 1. message - data to be sent
2. type - type of the data 2. type - type of the data
3. options - (optional, options detailed at end of module) 3. options - (optional, options detailed at end of module)
* Resolves: Sent-Status (string) | Rejects: error
#### requestApplicationData #### requestApplicationData
floCloudAPI.requestApplicationData(options = {}) floCloudAPI.requestApplicationData(options = {})
`requestApplicationData` requests application data from the cloud. `requestApplicationData` requests application data from the cloud.
1. options - (optional, options detailed at end of module) 1. options - (optional, options detailed at end of module)
* Resolves: data (Object) | Rejects: error
#### sendGeneralData #### sendGeneralData
floCloudAPI.sendGeneralData(message, type, options = {}) 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 1. message - data to be sent
2. type - type of the data 2. type - type of the data
3. options - (optional, options detailed at end of module) 3. options - (optional, options detailed at end of module)
* Resolves: Sent-Status (string) | Rejects: error
#### requestGeneralData #### requestGeneralData
floCloudAPI.requestGeneralData(type, options = {}) floCloudAPI.requestGeneralData(type, options = {})
`requestGeneralData` requests application data from the cloud. `requestGeneralData` requests application data from the cloud.
1. type - type of the data 1. type - type of the data
2. options - (optional, options detailed at end of module) 2. options - (optional, options detailed at end of module)
* Resolves: Status (string) | Rejects: error
#### resetObjectData #### resetObjectData
floCloudAPI.resetObjectData(objectName, options = {}) 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 1. objectName - Name of the objectData to be reset
2. options - (optional, options detailed at end of module) 2. options - (optional, options detailed at end of module)
Note: value of objectData is taken from floGlobals Note: value of objectData is taken from floGlobals
* Resolves: Sent-Status (string) | Rejects: error
#### updateObjectData #### updateObjectData
floCloudAPI.updateObjectData(objectName, options = {}) 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 1. objectName - Name of the objectData to be updated
2. options - (optional, options detailed at end of module) 2. options - (optional, options detailed at end of module)
Note: value of objectData is taken from floGlobals Note: value of objectData is taken from floGlobals
* Resolves: Sent-Status (string) | Rejects: error
#### requestObjectData #### requestObjectData
floCloudAPI.requestObjectData(objectName, options = {}) floCloudAPI.requestObjectData(objectName, options = {})
`requestObjectData` requests application data from the cloud. `requestObjectData` requests application data from the cloud.
1. objectName - Name of the objectData to be requested 1. objectName - Name of the objectData to be requested
2. options - (optional, options detailed at end of module) 2. options - (optional, options detailed at end of module)
* Resolves: Status (string) | Rejects: error
#### options: #### options:
* send options: * send options: