AsyncStorageStorage Domain
The AsyncStorageStorage domain is a custom CDP domain for inspecting and modifying AsyncStorage in React Native apps.
Overview
The AsyncStorageStorage domain allows you to inspect and modify AsyncStorage instances used in React Native from Chrome DevTools.
Methods
AsyncStorageStorage.enable
Enables the AsyncStorageStorage domain. When enabled, snapshots of all registered AsyncStorage instances are automatically sent.
AsyncStorageStorage.getAsyncStorageItems
Gets all items from an AsyncStorage instance.
Parameters:
instanceId(string): AsyncStorage instance ID
Returns:
entries: Array of items (each item is a string array in the format[key, value])
AsyncStorageStorage.setAsyncStorageItem
Sets an item in an AsyncStorage instance.
Parameters:
instanceId(string): AsyncStorage instance IDkey(string): Keyvalue(string): Value (AsyncStorage only stores strings)
AsyncStorageStorage.removeAsyncStorageItem
Removes an item from an AsyncStorage instance.
Parameters:
instanceId(string): AsyncStorage instance IDkey(string): Key to remove
AsyncStorageStorage.clear
Removes all items from an AsyncStorage instance.
Parameters:
instanceId(string): AsyncStorage instance ID
Events
AsyncStorageStorage.asyncStorageInstanceCreated
Emitted when an AsyncStorage instance is created.
Parameters:
instanceId(string): AsyncStorage instance ID
AsyncStorageStorage.asyncStorageItemAdded
Emitted when an AsyncStorage item is added.
Parameters:
instanceId(string): AsyncStorage instance IDkey(string): KeynewValue(string): New value
AsyncStorageStorage.asyncStorageItemUpdated
Emitted when an AsyncStorage item is updated.
Parameters:
instanceId(string): AsyncStorage instance IDkey(string): KeyoldValue(string): Old valuenewValue(string): New value
AsyncStorageStorage.asyncStorageItemRemoved
Emitted when an AsyncStorage item is removed.
Parameters:
instanceId(string): AsyncStorage instance IDkey(string): Removed key
AsyncStorageStorage.asyncStorageItemsCleared
Emitted when all items in an AsyncStorage instance are cleared.
Parameters:
instanceId(string): AsyncStorage instance ID
Usage
To register AsyncStorage instances in your React Native app:
Notes
- The AsyncStorageStorage domain is a React Native-only custom CDP domain.
- AsyncStorage instances must be registered using
registerAsyncStorageDevTools()to be inspectable in DevTools. - AsyncStorage only stores strings, so all values are sent as strings.
- All AsyncStorage methods (setItem, removeItem, clear, multiSet, multiRemove, multiMerge) are automatically hooked to detect changes.