Document createTablePlugin

Summary: Per title

Reviewed By: priteshrnandgaonkar

Differential Revision: D28991859

fbshipit-source-id: 1af38d8922157b1613e43d987871e664d8e6f5ba
This commit is contained in:
Michel Weststrate
2021-06-09 07:25:19 -07:00
committed by Facebook GitHub Bot
parent d2095d5937
commit fac991b538
2 changed files with 33 additions and 10 deletions

View File

@@ -25,17 +25,18 @@ type PluginResult<Raw, Row> = {
};
/**
* createTablePlugin creates a Plugin class which handles fetching data from the client and
* displaying in in a table. The table handles selection of items and rendering a sidebar where
* more detailed information can be presented about the selected row.
* `createTablePlugin` creates a plugin that handles receiving data from the client and
* displaying it in a table. The table handles selection of items, sorting, filtering and
* rendering a sidebar where more detailed information can be presented about the selected row.
*
* The plugin expects the be able to subscribe to the `method` argument and recieve either an array
* of data objects or a single data object. Each data object represents a row in the table which is
* build by calling the `buildRow` function argument.
* The plugin expects the be able to subscribe to the `method` argument and receive either single data objects.
* Each data object represents a row in the table.
*
* An optional resetMethod argument can be provided which will replace the current rows with the
* data provided. This is useful when connecting to Flipper for this first time, or reconnecting to
* the client in an unknown state.
* An optional `resetMethod` argument can be provided which will replace the current rows with the data provided.
* This is useful when connecting to Flipper for this first time, or reconnecting to the client in an unknown state.
*
* Since the `createTablePlugin` defines both the `plugin` and `Component` for the plugin in one go,
* making the result is most easily done by using `module.exports = createTablePlugin(....)` so that both are exported from the plugin package.
*/
export function createTablePlugin<Row extends object>(props: {
method: string;