<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: dojo.hitch and scope - more romance</title>
	<atom:link href="http://dojocampus.org/content/2008/07/15/dojohitch-and-scope-again/feed/" rel="self" type="application/rss+xml" />
	<link>http://dojocampus.org/content/2008/07/15/dojohitch-and-scope-again/</link>
	<description>The definitive resource for all things Dojo: past, present, future.</description>
	<pubDate>Wed, 07 Jan 2009 01:46:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: sfoster</title>
		<link>http://dojocampus.org/content/2008/07/15/dojohitch-and-scope-again/#comment-243</link>
		<dc:creator>sfoster</dc:creator>
		<pubDate>Tue, 15 Jul 2008 18:47:22 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=154#comment-243</guid>
		<description>@seth - you are absolutely right, I'm looking for a side-effect there which just isn't going to happen. I'll rewrite this later in the interest of accuracy (rather than revisionist history)</description>
		<content:encoded><![CDATA[<p>@seth - you are absolutely right, I&#8217;m looking for a side-effect there which just isn&#8217;t going to happen. I&#8217;ll rewrite this later in the interest of accuracy (rather than revisionist history)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seth</title>
		<link>http://dojocampus.org/content/2008/07/15/dojohitch-and-scope-again/#comment-241</link>
		<dc:creator>seth</dc:creator>
		<pubDate>Tue, 15 Jul 2008 16:29:26 +0000</pubDate>
		<guid isPermaLink="false">http://dojocampus.org/content/?p=154#comment-241</guid>
		<description>The example with init() doesn't work for me.  It always prints out the window.location:

Here's what I ran in firebug using dojo 1.0.2 off of the AOL CDN:

dojo.declare("Person", null, {
  constructor: function(name, petName) {
    this.name = name;
    this.getPrivateName = function() {
      return petName;
    }
  },
  getName: function() {
    return this.name;
  },
  getLocation: function() {
    return location;
  }
});

person1 = new Person("Mr. First Person", "cuddles");

function init() {
 var location = "In the init function";
 console.log("init: ", location );
 window.locationGetter1 = function() { return location; };
 window.locationGetter2 = dojo.hitch(person1, person1.getLocation);
 console.log( "init:", locationGetter2() );
}
init();
console.log( location );
console.log( locationGetter1() );
console.log(locationGetter2());</description>
		<content:encoded><![CDATA[<p>The example with init() doesn&#8217;t work for me.  It always prints out the window.location:</p>
<p>Here&#8217;s what I ran in firebug using dojo 1.0.2 off of the AOL CDN:</p>
<p>dojo.declare(&#8221;Person&#8221;, null, {<br />
  constructor: function(name, petName) {<br />
    this.name = name;<br />
    this.getPrivateName = function() {<br />
      return petName;<br />
    }<br />
  },<br />
  getName: function() {<br />
    return this.name;<br />
  },<br />
  getLocation: function() {<br />
    return location;<br />
  }<br />
});</p>
<p>person1 = new Person(&#8221;Mr. First Person&#8221;, &#8220;cuddles&#8221;);</p>
<p>function init() {<br />
 var location = &#8220;In the init function&#8221;;<br />
 console.log(&#8221;init: &#8220;, location );<br />
 window.locationGetter1 = function() { return location; };<br />
 window.locationGetter2 = dojo.hitch(person1, person1.getLocation);<br />
 console.log( &#8220;init:&#8221;, locationGetter2() );<br />
}<br />
init();<br />
console.log( location );<br />
console.log( locationGetter1() );<br />
console.log(locationGetter2());</p>
]]></content:encoded>
	</item>
</channel>
</rss>
