-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when found.configfn return false, m is null #1959
Conversation
Thank you for submitting this pull request, however I do not see a valid CLA on file for you. Before we can merge this request please visit https://yahoocla.herokuapp.com/ and agree to the terms. Thanks! 😄 |
I see |
function addModule has code like this, when ret === false, o = null, return null;
|
@@ -2038,7 +2038,10 @@ Y.log('Undefined module: ' + mname + ', matched a pattern: ' + | |||
temp: true | |||
}), mname); | |||
if (found.configFn) { | |||
m.configFn = found.configFn; | |||
//when found.configFn return false, m is null | |||
if(m) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found is always set when the module config is synthetically created based on a pattern, in which case addModule()
will ALWAYS return a valid config. In other words, if found is valid, m will be valid to get a setting assigned to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example, I want to use patterns like this:
patterns : {
"xxx-": {
configFn: function(mod) {
//I don't want to load this mod, but don't want to use test
return false;
}
}
}
then, execute this code:
ret = o.configFn(o);
if (ret === false) {
Y.log('Config function returned false for ' + name + ', skipping.', 'info', 'loader');
delete this.moduleInfo[name];
delete GLOBAL_ENV._renderedMods[name];
o = null;
}
yui.js throw error, if code allow configFn return false,the after code should be compatible。
CLA is valid! |
ah, that's a very edge case, jejejeje, but I see how you might want that. I will favor this PR, but you have to change it a little bit. Just re-use the existing if statement, like |
Updated the |
No description provided.