Update public docs to use Sandy

Summary: This updates the docs of Flipper to use Sandy, rather than `FlipperPlugin` class. Restructured the docs a bit as a result.

Reviewed By: passy

Differential Revision: D24991285

fbshipit-source-id: 66d5760c25cf9cf3983515433dfd64348d51db3d
This commit is contained in:
Michel Weststrate
2020-11-16 13:08:05 -08:00
committed by Facebook GitHub Bot
parent da6d6593a5
commit cc438e60ad
12 changed files with 418 additions and 592 deletions

View File

@@ -1,8 +1,8 @@
import {TestUtils} from 'flipper-plugin';
import * as Plugin from '..';
// Read more: https://fbflipper.com/docs/extending/desktop-plugins#testing-plugin-logic
// API: https://fbflipper.com/docs/extending/desktop-plugins#testing-plugin-logic
// Read more: https://fbflipper.com/docs/tutorial/js-custom#testing-plugin-logic
// API: https://fbflipper.com/docs/tutorial/js-custom#testing-plugin-logic
test('It can store data', () => {
const {instance, sendEvent} = TestUtils.startPlugin(Plugin);
@@ -23,8 +23,8 @@ test('It can store data', () => {
`);
});
// Read more: https://fbflipper.com/docs/extending/desktop-plugins#testing-plugin-logic
// API: https://fbflipper.com/docs/extending/desktop-plugins#testing-plugin-logic
// Read more: https://fbflipper.com/docs/tutorial/js-custom#testing-plugin-logic
// API: https://fbflipper.com/docs/tutorial/js-custom#testing-plugin-logic
test('It can render data', async () => {
const {instance, renderer, sendEvent} = TestUtils.renderPlugin(Plugin);

View File

@@ -10,7 +10,7 @@ type Events = {
newData: Data;
};
// Read more: https://fbflipper.com/docs/extending/desktop-plugins#creating-a-first-plugin
// Read more: https://fbflipper.com/docs/tutorial/js-custom#creating-a-first-plugin
// API: https://fbflipper.com/docs/extending/flipper-plugin#pluginclient
export function plugin(client: PluginClient<Events, {}>) {
const data = createState<Record<string, Data>>({}, {persist: 'data'});
@@ -31,7 +31,7 @@ export function plugin(client: PluginClient<Events, {}>) {
return {data};
}
// Read more: https://fbflipper.com/docs/extending/desktop-plugins#building-a-user-interface-for-the-plugin
// Read more: https://fbflipper.com/docs/tutorial/js-custom#building-a-user-interface-for-the-plugin
// API: https://fbflipper.com/docs/extending/flipper-plugin#react-hooks
export function Component() {
const instance = usePlugin(plugin);