Support custom data processing during import

Summary: Per title, this allows for pre-processing data after it is deserialized and before it is stored in the plugin

Reviewed By: nikoant

Differential Revision: D26126423

fbshipit-source-id: bc08a6ab205d2a0d551515563cd85a197595ddb2
This commit is contained in:
Michel Weststrate
2021-02-01 11:40:20 -08:00
committed by Facebook GitHub Bot
parent 34c915a739
commit f2ade40239
9 changed files with 340 additions and 21 deletions

View File

@@ -142,6 +142,13 @@ Usage: `client.onExport(callback: (idler, onStatusMessage) => Promise<state>)`
Overrides the default serialization behavior of this plugin. Should return a promise with state that is to be stored.
This process is async, so it is possible to first fetch some additional state from the device.
#### `onImport`
Usage: `client.onImport(callback: (snapshot) => void)`
Overrides the default de-serialization behavior of this plugin. Use it to update the state based on the snapshot data.
This hook will be called immediately after constructing the plugin instance.
### Methods
#### `send`