NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

javascript autocompletion support, how do I declare "that" to have the type of "this" for autocompletion?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    NetBeans Forums -> Ajax Users
View previous topic :: View next topic  
Author Message
Michael Joyner
Posted via mailing list.





PostPosted: Mon Oct 31, 2011 1:44 pm    Post subject: javascript autocompletion support, how do I declare "that" to have the type of "this" for autocompletion? Reply with quote

How do I declare "that" to have the type of "this" for autocompletion?

In the following code at "SessionObject.prototype.test", I declare that to be equal to this.
Autocompletion works as well for "this".
Autocompletion does not work for "that". Even if I put "/** @type SessionObject */" before the var declaration for "that". The variable "that" of course being required for proper inner function access to the "this" object.

function SessionObject (){
    this.vars={};
    this.coverList={};
    return this;
}
SessionObject.prototype.bookID=function(){
    var bookID=false;
    this.getUrlVars();
    bookID=parseInt(this.vars['bookID']);
    if (typeof bookID == 'undefined') bookID=0;
    return bookID;
};
SessionObject.prototype.getUrlVars=function(){
    // Read a page's GET URL variables and return them as an associative array.
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    this.vars=vars;
    return vars;
};

SessionObject.prototype.test=function(){
    var that=this;
    this. ;//Completion works for me
    that. ;//Completion does NOT work for me, even when /** @type SessionObject */ is used prior to that declaration.
}
Back to top
aserron



Joined: 07 Jun 2011
Posts: 7
Location: Uruguay

PostPosted: Tue Nov 29, 2011 11:42 pm    Post subject: Reply with quote

I think Netbeans doesn't have any idea of this as a variable.

this is related to a scope, global scope this = window, in some cases.

I fully agree Netbeans should be aware of this class.


Pd: try this.

Code:

if(false){   
   that = new SessionObject
}
Back to top
khusaini



Joined: 26 Nov 2011
Posts: 10
Location: indonesia

PostPosted: Mon Dec 05, 2011 12:51 pm    Post subject: Reply with quote

make me confuse
Century 21 Broker Properti Jual Beli Sewa Rumah Indonesia
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    NetBeans Forums -> Ajax Users All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo