Javascript code completion for revealing module pattern

Hi, I'm using phpStorm v3.0 and I have some modules that are writting using the revealing module pattern that looks like so:

var myModule = (function () {
     function myFunc1(arg1, arg2) {
     }

     function myFunc2(arg1) {
     }

     function privateFunc() {
     }

     return {
          myFunc1: myFunc1
          , myFunc2: myFunc2
     };
}());

// Now, use myModule
myModule.myFunc1(param1, param2);


Unfortuantely, because of the way the module is written, calling myModule.myFunc1 references the returned object and doesn't seem to know about the actual signature of myFunc1().  Is there some way to fix this so that typing myModule.myFunc will then show me the code completion hints?

Thanks

5 comments

Now this is fixed (http://youtrack.jetbrains.com/issue/WI-9601), but what about same reveling module pattern, but a bit different method definition syntax.

This following syntax still is not supported and autocomplete thinks myFunc1 is object and not a function. I think this syntax also should be supported, what do you think?

var myModule = (function () {

     var myFunc1 = function(arg1, arg2) {
     }

     var myFunc2 function(arg1) {
     }

     var privateFunc function() {
     }

     return {
          myFunc1: myFunc1
          , myFunc2: myFunc2
     };
}());

0

Fixed, but please next time don't hesitate to create a separate request ;)

0

Please sign in to leave a comment.