Migrate website to Docusaurus 2

Summary:
Docusaurus 2 is quite a lot more powerful than docu 1 it turns out.
This should convert the website fully.

* [done] Go through migration guide https://v2.docusaurus.io/docs/migrating-from-v1-to-v2
* [done] Convert landing page html
* [done] Convert all images to img tags
* [done] Convert all .md files to .mdx
* [done] Make sure ui-doc generation and including still works
* [done] Scan every page visually for sanity check
* [done] Make sure footer still works
* [done] Make sure search still works
* [done] Change all links/ to links/index
* [done] Change all links.md to links
* [done] Add some custom css to make the navbar look like the old one and darken the footer.

Reviewed By: passy

Differential Revision: D21158717

fbshipit-source-id: 5f45b711b1b6fd5ece4c5c15c55635c7ebbfb568
This commit is contained in:
John Knox
2020-04-27 04:01:24 -07:00
committed by Facebook GitHub Bot
parent 297ca61c49
commit 5f1a0548f5
101 changed files with 5110 additions and 2159 deletions

View File

@@ -0,0 +1,23 @@
---
id: client-plugin-lifecycle
title: Client Plugin Lifecycle
---
import useBaseUrl from '@docusaurus/useBaseUrl';
There are two types of client plugin: Regular and Background plugins. We recommend starting off as a regular plugin and switching it to a background plugin if necessary.
For both types of plugin, we recommend starting work after `onConnect` is called, and terminating it after `onDisconnect`, when possible. This prevents wasted computation when Flipper isn't connected. If the plugin needs to keep track of events that occur before it gets connected (such as initial network requests on app startup), you should do so in the plugin constructor (or ideally in a separate class).
## Regular Plugin Lifecycle
For regular plugins, `onConnect` and `onDisconnect` are triggered when the user opens the plugin in the Flipper UI, and when they switch to another plugin, respectively.
<img alt="Regular Plugin Lifecycle diagram" src={useBaseUrl("img/regular-plugin-lifecycle.png")} />
## Background Plugin Lifecycle
For background plugins, `onConnect` is called when Flipper first connects, and `onDisconnect` when it disconnects. The user does not need to be viewing the plugin for it to send messages; they will be queued up until the next time the user opens the plugin where they will be processed.
Even for background plugins, `onDisconnect` and `onConnect` may be called on a plugin (e.g. if the user restarts Flipper). Plugins should handle this accordingly by making sure to resend any important data to the reconnected instance.
<div class="warning">
Note that a plugin must be enabled by the user for its messages to be queued up.
</div>
<img alt="Background Plugin Lifecycle diagram" src={useBaseUrl("img/bg-plugin-lifecycle.png")} />