javascript - RequireJS: Config parameters not being passed into package -
i'm trying send configuration parameters package's main.js file , doesn't seem working. doing wrong? here's files , path information
/config.js
require.config({ baseurl : '../src', config : { 'aam' : { : null, set : null } }, packages : [ 'aam'] });
/src/aam/main.js
require.config({ paths : { aamaspermission : 'aam/perms/aspermission' } }); // start main app logic. requirejs(['aamaspermission'], function(aamaspermission) { });
/src/aam/perms/aspermission
define(['module'], function(module) { module.config() // empty object. why? .... });
in /src/aam/perms/aspermission, object returned module.config() empty. why?
according documentation:
for passing config package, target main module in package, not package id:
so should configure this:
require.config({ baseurl : '../src', config : { // target module, not package 'aam/perms/aspermission' : { : null, set : null } }, packages : [ 'aam'] });
if doesn't meet needs, might try separate global module holding singleton: using requirejs, how pass in global objects or singletons around?
Comments
Post a Comment