Summary: JS/TS api: - migrate to TS - some refactoring (get rid of bridge, make client abstract) Implementation isn't full yet, things to be implemented: - let plugins connect on init command from Flipper - implement Responder Further plans: - make fully compatible with react-native api without breaking changes Reviewed By: mweststrate Differential Revision: D21839377 fbshipit-source-id: 9e9fe4ad01632f958b59eb255c703c6cbc5fafe2
35 lines
630 B
Markdown
35 lines
630 B
Markdown
# flipper-sdk-api
|
|
|
|
SDK to build Flipper clients for JS based apps
|
|
|
|
## Installation
|
|
|
|
`yarn add flipper-client-sdk`
|
|
|
|
## Usage
|
|
|
|
## Example
|
|
|
|
```TypeScript
|
|
class SeaMammalPlugin extends AbsctractFlipperPlugin {
|
|
getId(): string {
|
|
return 'sea-mammals';
|
|
}
|
|
|
|
runInBackground(): boolean {
|
|
return true;
|
|
}
|
|
|
|
newRow(row: {id: string, url: string, title: string}) {
|
|
this.connection?.send("newRow", row)
|
|
}
|
|
}
|
|
|
|
const flipperClient = newWebviewClient();
|
|
cosnt plugin = new SeaMammalPlugin();
|
|
flipperClient.addPlugin();
|
|
flipperClient.start('Example JS App');
|
|
plugin.newRow({id: '1', title: 'Dolphin', url: 'example.com'})
|
|
|
|
```
|