From e308a89ade8e129fb81e34ef18d9b55cc95e689c Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 17 Feb 2021 13:53:44 +0100 Subject: [PATCH 1/3] docs: fixing custom implementations of utitiy apis --- docs/api/utility-apis.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/api/utility-apis.md b/docs/api/utility-apis.md index 5b5656f1b1..c039f33bf5 100644 --- a/docs/api/utility-apis.md +++ b/docs/api/utility-apis.md @@ -181,7 +181,25 @@ The `IgnoringErrorApi` would then be imported in the app, and wired up like this: ```ts -builder.add(errorApiRef, new IgnoringErrorApi()); +const app = createApp({ + apis: [ + /* ApiFactories */ + createApiFactory(errorApiRef, new IgnoringErrorApi()) + + // OR + // if you have dependencies inside your additional API you can use the object form + createApiFactory({ + api: errorApiRef, + deps: { configApi: configApiRef }, + factory({ configApi }) { + return new IgnoringErrorApi({ + reportingUrl: configApi.getString('error.reportingUrl'), + }); + }, + }), + ], + // ... other options +}); ``` Note that the above line will cause an error if `IgnoreErrorApi` does not fully From 8425f6d10fc8825c68db821cfa36d0d7f7f6ba86 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 17 Feb 2021 13:56:29 +0100 Subject: [PATCH 2/3] chore: fixing syntax --- docs/api/utility-apis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/utility-apis.md b/docs/api/utility-apis.md index c039f33bf5..904848b664 100644 --- a/docs/api/utility-apis.md +++ b/docs/api/utility-apis.md @@ -184,7 +184,7 @@ this: const app = createApp({ apis: [ /* ApiFactories */ - createApiFactory(errorApiRef, new IgnoringErrorApi()) + createApiFactory(errorApiRef, new IgnoringErrorApi()), // OR // if you have dependencies inside your additional API you can use the object form From 758bde62663891101bf087c50ecb51946cd8ed29 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 17 Feb 2021 13:57:32 +0100 Subject: [PATCH 3/3] chore: fix code review --- docs/api/utility-apis.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/utility-apis.md b/docs/api/utility-apis.md index 904848b664..308544e0f1 100644 --- a/docs/api/utility-apis.md +++ b/docs/api/utility-apis.md @@ -187,7 +187,7 @@ const app = createApp({ createApiFactory(errorApiRef, new IgnoringErrorApi()), // OR - // if you have dependencies inside your additional API you can use the object form + // If your API has dependencies, you use the object form createApiFactory({ api: errorApiRef, deps: { configApi: configApiRef },