@@ -27,16 +27,17 @@ class OutputManager extends HTMLManager {
2727// Define our own custom module loader for Shiny
2828const shinyRequireLoader = async function ( moduleName : string , moduleVersion : string ) : Promise < any > {
2929
30- // shiny provides require.js and also sets `define.amd=false` to prevent <script>s
31- // with UMD loaders from triggering anonymous define() errors. shinywidgets should
32- // generally be able to avoid anonymous define errors though since there should only
33- // be one 'main' anonymous define() for the widget's module (located in a JS file that
34- // we've already require.config({paths: {...}})ed; and in that case, requirejs adds a
35- // data-requiremodule attribute to the <script> tag that shiny's custom define will
36- // recognize and use as the name).)
30+ // shiny provides a shim of require.js and also sets `define.amd=false` to
31+ // allow <script>s with anonymous define()s to be loaded without error.
32+ // Note that, when anonymous define()s are used, the shim will leverage the
33+ // data-requiremodule attribute to determine the module name.
34+ // In the context of shinywidgets, when a widget gets rendered, it should
35+ // include another <script> tag that does `require.config({paths: {...}})`
36+ // to map the module name to the URL of the widget's JS file.
3737 const oldAmd = ( window as any ) . define . amd ;
3838
39- // The is the original value for define.amd that require.js sets
39+ // This is probably not necessary, but just in case -- especially now in a
40+ // anywidget/ES6 world, we probably don't want to load AMD modules
4041 ( window as any ) . define . amd = false ;
4142
4243 // Store jQuery global since loading we load a module, it may overwrite it
0 commit comments