From 996751a76bb050cf9989dc59586ff7203dfbccef Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Tue, 24 Aug 2021 12:07:18 -0400 Subject: [PATCH 1/4] Update getConfig.md --- dev-docs/publisher-api-reference/getConfig.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev-docs/publisher-api-reference/getConfig.md b/dev-docs/publisher-api-reference/getConfig.md index 9ff5f12ff9..e9fa5d324b 100644 --- a/dev-docs/publisher-api-reference/getConfig.md +++ b/dev-docs/publisher-api-reference/getConfig.md @@ -5,7 +5,7 @@ description: --- -The `getConfig` function is for retrieving the current configuration object or subscribing to configuration updates. When called with no parameters, the entire config object is returned. When called with a string parameter, a single configuration property matching that parameter is returned. +The `getConfig` function is for retrieving the current configuration object or subscribing to configuration updates. When called with no parameters, the entire config object is returned. When called with a string parameter, a single configuration property matching that parameter is returned. Be very careful with use of this function, as it returns a reference to the configuration instead of a clone. The readConfig function has been introduced for safer use. {% highlight js %} /* Get config object */ @@ -31,4 +31,4 @@ unsubscribe(); // no longer listening {% endhighlight %} -
\ No newline at end of file +
From 1d448e3479285036bcdff55fca6068c83b783391 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Tue, 24 Aug 2021 12:13:14 -0400 Subject: [PATCH 2/4] Create readConfig.md --- dev-docs/publisher-api-reference/readConfig.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 dev-docs/publisher-api-reference/readConfig.md diff --git a/dev-docs/publisher-api-reference/readConfig.md b/dev-docs/publisher-api-reference/readConfig.md new file mode 100644 index 0000000000..500b6701a6 --- /dev/null +++ b/dev-docs/publisher-api-reference/readConfig.md @@ -0,0 +1,18 @@ +--- +layout: api_prebidjs +title: pbjs.readConfig([string]) +description: +--- + + +The `readConfig` function is for retrieving the current configuration object or subscribing to configuration updates. When called with no parameters, the entire config object is returned. When called with a string parameter, a single configuration property matching that parameter is returned. The readConfig function has been introduced for safer use of the getConfig functionality, as it returns a clone. + +{% highlight js %} +/* Get config object */ +config.readConfig() + +/* Get debug config */ +config.readConfig('debug') +{% endhighlight %} + +
From 313005a5fdcd5a7eaa543f27f2d6d6cb31ebbb8e Mon Sep 17 00:00:00 2001 From: MartianTribe Date: Thu, 26 Aug 2021 11:16:35 -0400 Subject: [PATCH 3/4] Update getConfig.md --- dev-docs/publisher-api-reference/getConfig.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dev-docs/publisher-api-reference/getConfig.md b/dev-docs/publisher-api-reference/getConfig.md index e9fa5d324b..99ac02fd88 100644 --- a/dev-docs/publisher-api-reference/getConfig.md +++ b/dev-docs/publisher-api-reference/getConfig.md @@ -4,8 +4,9 @@ title: pbjs.getConfig([string]) description: --- +## Overview -The `getConfig` function is for retrieving the current configuration object or subscribing to configuration updates. When called with no parameters, the entire config object is returned. When called with a string parameter, a single configuration property matching that parameter is returned. Be very careful with use of this function, as it returns a reference to the configuration instead of a clone. The readConfig function has been introduced for safer use. +The `getConfig` function is used for retrieving the current configuration object or subscribing to configuration updates. When called with no parameters, the entire config object is returned. When called with a string parameter, a single configuration property matching that parameter is returned. Be careful with use of this function, as it returns a reference to the configuration instead of a clone. The readConfig function has been introduced for safer use. {% highlight js %} /* Get config object */ @@ -15,7 +16,10 @@ config.getConfig() config.getConfig('debug') {% endhighlight %} -The `getConfig` function also contains a 'subscribe' ability that adds a callback function to a set of listeners that are invoked whenever `setConfig` is called. The subscribed function will be passed the options object that was used in the `setConfig` call. Individual topics can be subscribed to by passing a string as the first parameter and a callback function as the second. For example: + +### Subscribe + +The `getConfig` function contains a `subscribe` feature that adds a callback function to a set of listeners that are invoked whenever `setConfig` is called. The `subscribed` function will be passed the `options` object that was used in the `setConfig` call. Individual topics can be subscribed to by passing a string as the first parameter and a callback function as the second. For example: {% highlight js %} From 594836293c9e9116123dd20013ea5a8c9b825eff Mon Sep 17 00:00:00 2001 From: MartianTribe Date: Thu, 26 Aug 2021 11:17:14 -0400 Subject: [PATCH 4/4] Update readConfig.md --- dev-docs/publisher-api-reference/readConfig.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-docs/publisher-api-reference/readConfig.md b/dev-docs/publisher-api-reference/readConfig.md index 500b6701a6..734647e762 100644 --- a/dev-docs/publisher-api-reference/readConfig.md +++ b/dev-docs/publisher-api-reference/readConfig.md @@ -5,7 +5,7 @@ description: --- -The `readConfig` function is for retrieving the current configuration object or subscribing to configuration updates. When called with no parameters, the entire config object is returned. When called with a string parameter, a single configuration property matching that parameter is returned. The readConfig function has been introduced for safer use of the getConfig functionality, as it returns a clone. +The `readConfig` function is used for retrieving the current configuration object or subscribing to configuration updates. When called with no parameters, the entire config object is returned. When called with a string parameter, a single configuration property matching that parameter is returned. The readConfig function has been introduced for safer use of the getConfig functionality, as it returns a clone. {% highlight js %} /* Get config object */