The Artima Developer Community
Sponsored Link

Java Buzz Forum
var self = this;

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
dion

Posts: 5028
Nickname: dion
Registered: Feb, 2003

Dion Almaer is the Editor-in-Chief for TheServerSide.com, and is an enterprise Java evangelist
var self = this; Posted: Apr 13, 2007 12:40 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by dion.
Original Post: var self = this;
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
Latest Java Buzz Posts
Latest Java Buzz Posts by dion
Latest Posts From techno.blog(Dion)

Advertisement
$.fn.delayHide(time, callbackArgument) {
        var self = this;
        setTimeout(function() {
                callbackArgument.call(self);
        }, time);
} 

I find that I have to use the var self = this; pattern far too often in JavaScript.

The darn magic scoping of this really gets ya.

I also had someone ask me why foo never ended up containing something:

var foo = bar(function() {
   ....
   return something;
});

It made me more worried about adding closures to Java :)

Read: var self = this;

Topic: Genuitec Exhibiting at IBM RSDC in June Previous Topic   Next Topic Topic: Debian 4.0 at long Last

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use