In modules world, there's possiblity that two different instance of same modules (e.g. installed in different node_modules) are being run in same process.
If for any reason they need to operate on context instance that's same for the given application or process, then ocassionally introduced multiple installations may break the application.
This module provides interface wich can be used to ensure that no matter how many instances of given module are loaded, in all cases they end with same context instance.
// No matter how many instances of given module are loaded in the process, they will always end with same context instance
const globalContext = require("uni-global")("my-scope-name");
// globalContext is a plain object, on which needed global data can be stored.
globalContext.someSingletonData = ...If there's a need to adapt other environment realm (e.g. coming from iframe) to share same uni-global directory.
Register it with adaptRealm util as below:
const adaptRealm = require("uni-global/adapt-realm");
adaptRealm(iFrameWindow); // Pass global object of the other realmnpm install uni-globalTo report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.