Skip to content

Commit 6705c6e

Browse files
committed
Allow null as storage return value.
Fixes #73.
1 parent eb36d24 commit 6705c6e

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/storage.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,8 @@ export const postMessageStorage = (
9999
): AsyncStorage => {
100100
const request = client(storageWindow, storageOrigin)
101101
return {
102-
getItem: async (key: string): Promise<?string> => {
103-
const ret = await request({ method: 'storage/getItem', args: [key] })
104-
if (typeof ret !== 'string') {
105-
throw new Error(
106-
`expected postMessage call for 'storage/getItem' to return a string, but got value ${ret}`
107-
)
108-
}
109-
return ret
102+
getItem: (key: string): Promise<?string> => {
103+
return request({ method: 'storage/getItem', args: [key] })
110104
},
111105

112106
setItem: (key: string, val: string): Promise<void> => {

0 commit comments

Comments
 (0)