[ 3 posts ]

michael

  • Username: mixersoft
  • Joined: Wed Oct 14, 2009 2:02 am
  • Posts: 13
  • IRC: mixersoft
  • Offline
  • Profile
Tags:

YUI().use callback doesn't work with Eclipse outline view

Post Posted: Fri Aug 06, 2010 9:58 am
+0-
Code:

Global = {};

YUI().use('node', function(Y) {

  // none of these attributes, methods, or class defs show up in the eclipse outline view
  var someVar = null;

  var MyClass = function(cfg) {
    this.cfg = cfg;
    this.getDom = function(n){
       return Y.Node.getDOMNode(n);
    };
  }

  Global.MyClass = MyClass;

});


When I use the YUI3 coding style, where everything is wrapped inside the anonymous function, none of the classes or attributes inside the anonymous function show up in the Eclipse outline view. (I'm actually using Aptana Studio, but it's based on Eclipse).

Typically, I'm trying to build a class that uses YUI3 internally.

Is there a fix or workaround for that? Am I using the wrong pattern? Because when my class defs get big, it's a little hard to navigate by scrollbar.

Many thanks.

wetry

  • Username: wetry
  • Joined: Mon May 17, 2010 8:00 am
  • Posts: 6
  • Offline
  • Profile
Tags:

Re: YUI().use callback doesn't work with Eclipse outline vie

Post Posted: Mon Aug 16, 2010 12:00 am
+0-
Hello!
I use Eclipse with aptana but not Aptana JS editor.
Open this code

Code:
Global = {};

YUI().use('node', function(Y){

   // none of these attributes, methods, or class defs show up in the eclipse outline view
   var someVar = null;
   
   /**
    * @constructor
    */
   Global.MyClass = function(cfg){
      this.cfg = cfg;
      this.getDom = function(n){
         return Y.Node.getDOMNode(n);
      };
   };
   
});


with JavaScript Editor:

Image.

But maybe it is not exactly what you need..

michael

  • Username: mixersoft
  • Joined: Wed Oct 14, 2009 2:02 am
  • Posts: 13
  • IRC: mixersoft
  • Offline
  • Profile
Tags:

Re: YUI().use callback doesn't work with Eclipse outline vie

Post Posted: Mon May 09, 2011 6:05 pm
+0-
I've started using this pattern to load yui
Code:

Global = {};

YUI().use('node', 'my-class', function(Y) {
  Global.Y = Y
  var detach = Y.on('domready", function(){
      detach.detach();
      Global.main(Y);
  }
}
Global.main = function(Y){
// javascript startup code
}


and my JS class in a separate file

Code:
// module pattern in 'my-class.js' file, loaded by Y.use()
(function(){
   var Y = Global.Y;

  // none of these attributes, methods, or class defs show up in the eclipse outline view
  var someVar = null;

  var MyClass = function(cfg) {
    this.cfg = cfg;
    this.getDom = function(n){
       return Y.Node.getDOMNode(n);
    };
  }
  MyClass.prototype={};   // this line makes class show up in eclipse outline

  Global.MyClass = MyClass;

})();


It works. Now I can see my Classes in eclipse outline view, so it's easier to navigate through my code. But it seems like I'm doing things the hard way. any better patterns out there?
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum