[docs] added skeleton

This commit is contained in:
Bilawal Hameed
2020-03-26 11:21:46 +01:00
parent 88a6b3d7c4
commit 8145ba8b94
3 changed files with 22 additions and 3 deletions
+1
View File
@@ -4,5 +4,6 @@ APIs and Components
- [createPlugin](createPlugin.md)
- [createPlugin - router](createPlugin-router.md)
- [createPlugin - feature flags](createPlugin-feature-flags.md)
[Back to Docs](../README.md)
@@ -0,0 +1,15 @@
# createPlugin - feature flags
The `featureFlags` object passed to the `register` function makes it possible for plugins to register Feature Flags in Backstage for users to opt into. You can use this to split out logic in your code for manual A/B testing, etc.
```typescript
// This needs to be updated.
```
Then, later, if you want to check if the user has enabled them:
```typescript
// This needs to be updated.
```
[Back to References](README.md)
+6 -3
View File
@@ -17,13 +17,14 @@ type PluginHooks = {
};
```
[Read more about the router here](createPlugin-router.md)
- [Read more about the router here](createPlugin-router.md)
- [Read more about feature flags here](createPlugin-feature-flags.md)
## Example Uses
### Creating a basic plugin
Showcasing adding multiple routes and a redirect.
Showcasing adding multiple routes, a feature flag and a redirect.
```jsx
import { createPlugin } from '@backstage/core';
@@ -31,7 +32,9 @@ import ExampleComponent from './components/ExampleComponent';
export default createPlugin({
id: 'new-plugin',
register({ router }) {
register({ router, featureFlags: { registerFeatureFlag } }) {
registerFeatureFlag('enable-example-component');
router.registerRoute('/new-plugin', ExampleComponent);
},
});