This package will never have breaking change and keeps everything simple and backward-compatible.
A simple key-value store singleton.
Sometimes you have to do horrible things, like use the global object to share a singleton or some values.
Instead of attaching values to the global object, which can lead to security concerns, this
global-box package provides a key-value
store which is guaranteed to be a singleton, so you can use it instead of the global object. Only code that are part of the same application bundle can access this
store, making it more secured.
;;box.get'share.config.something'; // 123;
For this to work correctly, there must be only a single copy of
node_modules at all times. (Similar to how there must be only a single copy of
Note: This package will never have breaking change and keeps everything simple and backward-compatible.
- For application developers, just do a regular installation. If you want to use
global-boxdirectly, or have some libraries that depends on it.
npm install global-box
- For library authors, you must always list this as
package.json. Listing it as
dependenciesmay cause the library consumers to have duplicates in the final application.
vs. in application
;;box.hasglobalId;box.getglobalId; // must specify value type via genericbox.getOrCreateglobalId, factory;box.removeglobalId;box.setglobalId;
Inspired by global-cache