Loose augmentation of modules
When we try to enhance a module using the augmentation technique previously discussed, we pass a reference of the module to another part of our code which is responsible for doing the augmentation work.
How can we add functionality to an object that has not been loaded or created yet?
The answer to this question becomes very important when our modules (files) are loaded in an asynchronous fashion, and we have no way of making sure that our original module is loaded before the augmentation code that enhances the module.
One of the beautiful and powerful aspects of JavaScript is its ability to add properties to objects dynamically, at any time during code execution. This allows us to add functionality or modify our original module's implementation even before the module is loaded, as long as we provide a temporary object in the absence of the module. This temporary object will be added to the original module after the module is loaded (or more accurately, it becomes...