introduce onReady life-cycle
Summary: Flipper Sandy plugins didn't have an event to hook into that is run _after_ any state snapshot is loaded, which was needed by the graphQL plugin, as they do some post processing when a data snapshot is restored. Reviewed By: passy Differential Revision: D28189573 fbshipit-source-id: 4ef992f3fafc32787eab3bc235059f2c41396c80
This commit is contained in:
committed by
Facebook GitHub Bot
parent
616341f649
commit
dd7a9f5195
@@ -192,6 +192,13 @@ export function plugin(client: PluginClient) {
|
||||
}
|
||||
```
|
||||
|
||||
### `onReady`
|
||||
|
||||
The `onReady` event is triggered immediately after a plugin has been initialized and any pending state was restored.
|
||||
This event fires after `onImport` / the interpretation of any `persist` flags and indicates that the initialization process has finished.
|
||||
This event does not signal that the plugin is loaded in the UI yet (see `onActivated`) and does fire before deeplinks (see `onDeeplink`) are handled.
|
||||
If a plugin has complex initialization logic it is recommended to put it in the `onReady` hook, as an error in the onReady hook won't cause the plugin not to be loaded.
|
||||
|
||||
### Methods
|
||||
|
||||
#### `send`
|
||||
|
||||
@@ -96,6 +96,7 @@ Some abstractions that used to be (for example) static methods on `FlipperPlugin
|
||||
| `exportPersistedState` | Use the `client.onExport` hook |
|
||||
| `getActiveNotifications` | Use `client.showNotification` for persistent notifications, or `message` / `notification` from `antd` for one-off notifications.
|
||||
| `createTablePlugin` | TBD, so these conversions can be skipped for now |
|
||||
| `init` | `client.onReady` |
|
||||
|
||||
|
||||
## Using Sandy / Ant.design to organise the plugin UI
|
||||
|
||||
Reference in New Issue
Block a user