Applied UMD pattern to Date* libraries and the plugin itself. Now, when loading the calendar plugin with an AMD loader, such as RequireJS, we avoid polluting the global window object. In addition, Date* libraries can be loaded individually:
define(['DateTime'], function(DateTime) {
// use DateTime in user code
})
When not using an AMD loader, we inject Date* libraries into the global window object as before.
A benefit of applying the UMD pattern is that the dependencies of each module and changes to the global window object are explicit.
Applied UMD pattern to Date* libraries and the plugin itself. Now, when loading the calendar plugin with an AMD loader, such as RequireJS, we avoid polluting the global window object. In addition, Date* libraries can be loaded individually:
When not using an AMD loader, we inject Date* libraries into the global window object as before.
A benefit of applying the UMD pattern is that the dependencies of each module and changes to the global window object are explicit.