Files
flipper/flipper-js-client-sdk
Timur Valiev 1d55b35dfd v0.0.3 - bug fixes
Summary:
couple of bug fixes:
1) we don't want to init plugins on connect - let's wait for init command from flipper
2) on disonnect - "this" didn;t work well with .map() so i switched to old school loop

Reviewed By: jknoxville

Differential Revision: D23623946

fbshipit-source-id: cb3f579a8ee14fedfbe19895f31f77f9e08775d2
2020-09-10 08:18:14 -07:00
..
2020-09-10 08:18:14 -07:00
2020-06-11 08:45:35 -07:00
2020-09-10 08:18:14 -07:00
2020-06-11 08:45:35 -07:00

flipper-sdk-api

SDK to build Flipper clients for JS based apps

Installation

yarn add flipper-client-sdk

Usage

Example

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'})