javascript - How to make a requirejs module with multiple files -


i wondering how make requirejs module multiple files. e.x. require 1 file somehow gets multiple files. know this:

define([all other files], function () {   var mod = {},       files = [all other files];      arguments.foreach(function (i) {     mod.[files[i]] = i;   });   return mod;  }); 

but wondering whether there better method?

you want dynamic list of files(.txt,.tpl,.htm,.json), avoid change in js source code add more files.

i don't know if there way that, must take care time take download files. suggest create json file files want download, , iterate through array of files using ajax them.

if try module inside directory, need create js file: <package-all>.js encapsulate require([all files],function()); example.

i believe way solve this.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -