This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 235364 - Anonymous Function With Object{}, Exposing Local Vars to Window Object For Code Completion
Summary: Anonymous Function With Object{}, Exposing Local Vars to Window Object For Co...
Status: NEW
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-01 12:44 UTC by gwillie
Modified: 2014-11-12 12:35 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gwillie 2013-09-01 12:44:01 UTC
I couldnt find much as for other bugs/feature requests, Bug 224463 would be similar but not really.

For javascript: we have an anonymous function with object that we expose back to window eg

(function(window)
{
  function somefunc()
  {
    // this method wont be exposed for code completion
    // as was not passed back to window object
  }

  // this obj should have code completion outside of anonymous function
  var obj = {
    method: function()
    {
      // more...code
      return obj.method.instance.meth1();
    },
    literal:{
      key1: 'val1'
    }
  };
// set some vars
obj.method.instance = new somelib();
// expose obj back to window
window.obj = obj;
})(window);

i utilise this pattern so i can instantiate an otherwise static object.

it would be nice if the editor could pick up on this fact and expose any object or var that was explicitly exposed (eg window.obj = obj;).

Just a thought.

Thanks
Comment 1 Petr Pisl 2014-11-12 12:35:42 UTC
The problem is that in your example window is the name of the parameter. We can not really on the name of parameter. I can implement this pattern, but it will not probably work in all cases.