Docs : SDK : openDatabase
openDatabase lets you retrieve your user's data. You also need to have a database open before storing or modifying user data. This API will return a promise that gets resolved once the database becomes available for use.
userbase.openDatabase({ databaseName, changeHandler })
.then(() => {
// the database can now be used
})
.catch((e) => console.error(e))
Parameters
-
databaseName [string | Len: 1-50] - The database name to use.
-
changeHandler [function] - A callback that gets invoked when the database gets modified.
-
items [Array] - The full collection of items in the database, in insertion order.
- itemId [string] - The item's unique identifier.
- item [object] - The stored item.
Errors
- ParamsMustBeObject
- DatabaseAlreadyOpening
- DatabaseNameMustBeString
- DatabaseNameCannotBeBlank
- DatabaseNameTooLong
- ChangeHandlerMustBeFunction
- UserNotSignedIn
- ServiceUnavailable