docs: add code tabs

Summary: adding code tabs for Android, iOS and C++ to improve readability of pages.

Reviewed By: jknoxville

Differential Revision: D15167691

fbshipit-source-id: e7f602a3a1cbe39ef5da0a15bb0bbfc8f79e8ccc
This commit is contained in:
Daniel Büchele
2019-05-01 11:18:00 -07:00
committed by Facebook Github Bot
parent 8734b99f8d
commit b0d2983bd4
2 changed files with 23 additions and 30 deletions

View File

@@ -9,8 +9,9 @@ Plugins should be treated as singleton instances as there can only be one `Flipp
Plugins are identified by the string that their identifier method returns, in this example, "MyFlipperPlugin":
### Android
<!--DOCUSAURUS_CODE_TABS-->
<!--Android-->
```java
final FlipperClient client = AndroidFlipperClient.getInstance(context);
// Client may be null if AndroidFlipperClient.createInstance() was never called
@@ -20,17 +21,13 @@ if (client != null) {
plugin.sendData(myData);
}
```
### iOS
<!--iOS-->
```objective-c
FlipperClient *client = [FlipperClient sharedClient];
MyFlipperPlugin *myPlugin = [client pluginWithIdentifier:@"MyFlipperPlugin"];
[myPlugin sendData:myData];
```
### C++
<!--C++-->
```c++
auto &client = FlipperClient::instance();
@@ -45,5 +42,8 @@ myPlugin = client.getPlugin<MyFlipperPlugin>("MyFlipperPlugin");
myPlugin->sendData(myData);
```
```
<!--END_DOCUSAURUS_CODE_TABS-->
Here, `sendData` is an example of a method that might be implemented by the Flipper plugin.