From e308a89ade8e129fb81e34ef18d9b55cc95e689c Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 17 Feb 2021 13:53:44 +0100 Subject: [PATCH] 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