frontend-plugin-api: switch naming recommendation from define to defineParams

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2025-08-01 11:11:51 +02:00
parent e739a01e2d
commit 147482b700
40 changed files with 225 additions and 214 deletions
@@ -62,14 +62,14 @@ Apart from the addition of the blueprint parameters of the first argument to the
### Creating an extension from a blueprint with advanced parameter types
Some blueprints may be defined with something known as "advanced parameter types". This is a feature that enables type inference and transform of the blueprint parameters, and the way that you pass the parameters look a little bit different. Rather than passing the parameters directly, they are instead passed as a callback function of the form `define => define(<params>)`.
Some blueprints may be defined with something known as "advanced parameter types". This is a feature that enables type inference and transform of the blueprint parameters, and the way that you pass the parameters look a little bit different. Rather than passing the parameters directly, they are instead passed as a callback function of the form `defineParams => defineParams(<params>)`.
An example of a blueprint that uses advanced parameter types is the `ApiBlueprint` blueprint. Using it to create a simple implementation for the `AlertApi` might look like this:
```ts
const alertApiBlueprint = ApiBlueprint.make({
params: define =>
define({
params: defineParams =>
defineParams({
api: alertApiRef,
deps: {},
factory: () => new MyAlertApi(),
@@ -82,8 +82,8 @@ This also works with `makeWithOverrides`, where the define callback is passed as
```ts
const alertApiBlueprint = ApiBlueprint.makeWithOverrides({
factory(originalFactory, { config }) {
return originalFactory(define =>
define({
return originalFactory(defineParams =>
defineParams({
api: alertApiRef,
deps: {},
factory: () => new MyAlertApi(config),