diff --git a/docs/site/src/content/docs/plugins/multiplatform/shared-constants.mdx b/docs/site/src/content/docs/plugins/multiplatform/shared-constants.mdx index 68b372163..ce0d932e4 100644 --- a/docs/site/src/content/docs/plugins/multiplatform/shared-constants.mdx +++ b/docs/site/src/content/docs/plugins/multiplatform/shared-constants.mdx @@ -23,7 +23,7 @@ const constantsPlugin = new ConstantsPlugin({ prop2: "B", }, namespace: "constants", - dataPath: "data.constants", + dataPath: "data.props", }); const player = new Player({ @@ -42,12 +42,12 @@ constantsPlugin.getConstants("prop1"); // 'A' ### Overriding Values in Content -The `dataPath` configuration option enables content to override specific values for a particular flow: +By default, data can be provided in the `constants` path of the `data` object to override the constants that the plugin was initialized with. This can be overridden though via the `dataPath` configuration option. In the above example, `dataPath` was initialized with the path `data.props` therefore the following code snippet could be used to override the `prop1` constant: ```json { "data": { - "constants": { + "props": { "prop1": "B" } } @@ -56,6 +56,17 @@ The `dataPath` configuration option enables content to override specific values using a similar query for `prop1`, the value in the content takes precidence and would return `B`. +If no `dataPath` is defined, then it defaults to `constants` and you can still do this +```json +{ + "data": { + "constants": { + "prop1": "B" + } + } +} +``` + ### Fallback Values Any query can also specify an optional _default_ value to return: