Skip to content

Commit 283bc26

Browse files
Scott TrinhScott Trinh
authored andcommitted
docs: Update API reference for getItem
1 parent 5c84e8d commit 283bc26

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ angular.module('yourModule', ['LocalForageModule'])
5252

5353
- `setItem(key/Array<key>, value/Array<value>)`: stores data (async, promise)
5454

55-
- `getItem(key/Array<key>)`: retrieves stored data (async, promise)
55+
- `getItem(key/Array<key>, rejectIfNull)`: retrieves stored data, rejects if rejectIfNull is truthy and one of the values is null (async, promise)
56+
57+
localForage will return null for a lookup on a key that does not exist. If you set `rejectIfNull` to
58+
true, it will reject the promise if the value (or one of the values of the array lookup) is null. If
59+
you normally store `null` in the database, you can use the single arity version of the function to
60+
retrieve the null value, but you have no way to know if you've retrieved `null` or if the key did
61+
not exist.
5662

5763
- `removeItem(key/Array<key>)`: removes stored data (async, promise)
5864

0 commit comments

Comments
 (0)