From a11cf88e07100974997363e5218cf6e7eca4d942 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 15 Apr 2019 14:46:00 -0600 Subject: [PATCH] Add a function to append/overwrite objects in the config on the fly Intended to be used to overwrite settings which may be calculated rather than provided. --- src/SdkConfig.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/SdkConfig.js b/src/SdkConfig.js index 78dd050a1e..eb18dad453 100644 --- a/src/SdkConfig.js +++ b/src/SdkConfig.js @@ -41,6 +41,12 @@ class SdkConfig { static unset() { global.mxReactSdkConfig = undefined; } + + static add(cfg) { + const liveConfig = SdkConfig.get(); + const newConfig = Object.assign({}, liveConfig, cfg); + SdkConfig.put(newConfig); + } } module.exports = SdkConfig;