I have made a YUI module a little like the code shown below, which is the recommended pattern for YUI3 stuff, both within YUI’s own core files and within Moodle as per here.
The problem is that now I can’t see any of the methods (such as initializer() and show() in the code below) in the IDE’s file structure/navigator pane. It seems that the Y.extend() logic is too much to handle, despite previous use of YAHOO.lang.Extend() outside of the sandboxed pattern used below working fine.
Has anyone any suggestions as to how to fix this? Is it just my IDE (tried IntelliJ IDEA – bug here, and NetBeans)? Surely the YUI devs don’t have this same problem do they?
YUI.add('moodle-local_hub-comments', function (Y) {
var COMMENTSNAME = 'hub_comments';
var COMMENTS = function () {
COMMENTS.superclass.constructor.apply(this, arguments);
}
M.local_hub = M.local_hub || {};
Y.extend(M.local_hub, Y.Base, {
// Invisible property:
event : null,
// Invisible function:
initializer : function (params) {
// function code here
},
// Invisible function:
show : function (e) {
// function code here
},
// Invisible function:
hide : function () {
// function code here
}
}, {
NAME : COMMENTSNAME,
ATTRS : {
commentids : {value : 450}
}
});
}, '@VERSION@', {
requires : ['base', 'overlay', 'moodle-enrol-notification']
//Note: 'moodle-enrol-notification' contains Moodle YUI exception
});
This appears to be a possible bug with IntelliJ, with details here. Good to know that they at least in theory support it.
As a worksround, JSDoc can be added above the extends function like this:
Which makes all the methods show up 🙂