<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="http://organizeseries.com/"
	>

<channel>
	<title>SitePen Blog &#187; Open Source</title>
	<atom:link href="http://www.sitepen.com/blog/category/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepen.com/blog</link>
	<description>SitePen Services and notes about Dojo, Persevere, CometD, JavaScript, and the Web</description>
	<lastBuildDate>Wed, 22 May 2013 22:36:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Introducing dojo-amd-converter</title>
		<link>http://www.sitepen.com/blog/2013/04/03/introducing-dojo-amd-converter/</link>
		<comments>http://www.sitepen.com/blog/2013/04/03/introducing-dojo-amd-converter/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 16:30:10 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[AMD]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=6299</guid>
		<description><![CDATA[<p>AMD offers many benefits over the legacy Dojo module syntax. While Dojo is forwards-compatible, to take advantage of the benefits of AMD, developers are often faced with the challenge of migrating and refactoring large quantities of boilerplate code from the legacy dojo.provide/dojo.require syntax to AMD&#8217;s define and require. As we make the upgrade to AMD [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/">AMD offers many benefits</a> over the legacy Dojo module syntax. While Dojo is forwards-compatible, to take advantage of the benefits of AMD, developers are often faced with the challenge of migrating and refactoring large quantities of boilerplate code from the legacy <code>dojo.provide/dojo.require</code> syntax to AMD&#8217;s <code>define</code> and <code>require</code>. As we make the upgrade to AMD in our projects, we also usually want to leverage the latest version of our evolving APIs. With early work beginning on Dojo 2.0, we definitely need to work together as a community to automate as much of the upgrade process as possible.</p>
<h2>Introducing the dojo-amd-converter</h2>
<p>We have created an alpha quality release of <a href="https://github.com/SitePen/dojo-amd-converter">dojo-amd-converter</a>, a tool for helping you make a one-time migration of your existing source code to a newer version of Dojo.</p>
<p>Be warned, the tool handles only 70-80% of the manual conversion process, and generally does better with more standard usage of Dojo. Normally we wait a bit longer before announcing our projects, but this should be useful in its early alpha state. We know this tool has quite a few open issues that need to be fixed and we invite you to help us improve it.</p>
<p>Our hope is that this conversion tool, which is today useful for converting pre-AMD code to AMD code, could also form the basis for a community effort to make it possible to migrate code bases more efficiently from Dojo 1.x (pre-AMD or AMD) to Dojo 2.x. That work has not yet started, since Dojo 2.0 is not yet an actual thing.</p>
<p><span id="more-6299"></span></p>
<h2>What does it do?</h2>
<p>Based on a <a href="https://github.com/SitePen/dojo-amd-converter/blob/master/handlers.js">collection of rules</a>, and leveraging Node.js, libxml.js, and esprima, the parser will take an existing Dojo source tree, and convert the following:</p>
<ul>
<li>non-AMD modules to AMD modules</li>
<li>namespace references to module references</li>
<li>legacy HTML custom attributes to HTML5 compliant data-dojo-*</li>
<li>legacy i18n bundles to AMD bundles</li>
<li>older Dojo APIs to their refined replacements</li>
</ul>
<p>For example, if before conversion you had a file like this:</p>
<pre lang="javascript">
dojo.provide("my.namespace.i18n.Bundle");
dojo.requireLocalization("dijit", "common");
dojo.requireLocalization("foo.package", "Bundle");
dojo.requireLocalization("bar.package", "Bundle2");

var foo = dojo.i18n.getLocalization("foo.package", "Bundle"),
	bar = dojo.i18n.getLocalization("bar.package", "Bundle2", foo.bar),
	baz = {
		locale: "en-lol",
		i18n: dojo.i18n.getLocalization("bar.package", "Bundle2", this.locale)
	};
</pre>
<p>You would end up with this, after conversion:</p>
<pre lang="javascript">
define([
	"dojo",
	"dojo/i18n",
	"dojo/i18n!bar/package/nls/Bundle2",
	"dojo/i18n!dijit/nls/common",
	"dojo/i18n!foo/package/nls/Bundle"
], function (dojo, i18n, i18nBundle2, i18ncommon, i18nBundle) {

	var foo = i18nBundle,
		bar = i18n.getLocalization("bar.package", "Bundle2", foo.bar),
		baz = {
			locale: "en-lol",
			i18n: i18n.getLocalization("bar.package", "Bundle2", this.locale)
		};
});
</pre>
<h2>Usage</h2>
<p>To use the dojo-amd-converter, Mac and Linux users should follow these simple steps:</p>
<ol>
<li>Clone the repo using Git:
<pre lang="bash">git clone --recursive https://github.com/SitePen/dojo-amd-converter.git</pre>
</li>
<li>Modify the provided config.js file to specify some basic settings for your application, such as your source and destination directories.</li>
<li>From within the repo, run the provided shell script on your configuration file:
<pre lang="bash">./parse.sh config.js</pre>
</ol>
<div class="tip">If you receive a permission denied error, you may need to chmod the shell script:</p>
<pre lang="bash">chmod +x parse.sh</pre>
</div>
<h2>config.js options</h2>
<ul>
<li><code>excludePaths</code> &#8211; An array of paths that will be excluded from processing.  Each path should be a regular expression</li>
<li><code>srcDir</code> &#8211; Root directory of the files to process.</li>
<li><code>distDir</code> &#8211; Output directory of the processed files.</li>
<li><code>printOutput</code> &#8211; Print output instead of sending it to the output directory.</li>
<li><code>makeDeclareAnonymous</code> &#8211; Make declare calls anonymous instead of leaving the first argument as-is.  This will avoid creating any global variables with declare.</li>
<li><code>removeUnusedDependencies</code> &#8211; Remove dependencies that are not referenced in a converted module.</li>
<li><code>onlyProcessTemplates</code> &#8211; Only process HTML files inside template directories.</li>
</ul>
<p>The AMD converter <a href="https://github.com/SitePen/dojo-amd-converter/issues/25">does not currently work on Windows</a>, due to the dependency on libxmljs.</p>
<h2>Getting Involved</h2>
<p>This project is in the early stages, and our hope is that it will also be used for work to convert to Dojo 2.0. We have <a href="https://github.com/SitePen/dojo-amd-converter/issues">many open issues</a> for items we have already identified in our work using this tool. The dojo-amd-converter tool is <a href="https://github.com/SitePen/dojo-amd-converter/blob/master/LICENSE">licensed</a> under the same terms and conditions as other Dojo Foundation projects.</p>
<p>To get involved, you will need to have a <a href="http://dojofoundation.org/about/cla">Dojo Foundation CLA on file</a> for us to consider your code change. Please get involved if this tool is of interest to you now or in the future, as we think it is a much needed improvement for making it easier to upgrade between Dojo releases.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2013/04/03/introducing-dojo-amd-converter/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Learning Dojo 1.8</title>
		<link>http://www.sitepen.com/blog/2012/12/06/learning-dojo-1-8/</link>
		<comments>http://www.sitepen.com/blog/2012/12/06/learning-dojo-1-8/#comments</comments>
		<pubDate>Thu, 06 Dec 2012 15:22:57 +0000</pubDate>
		<dc:creator>Mike Wilcox</dc:creator>
				<category><![CDATA[AMD]]></category>
		<category><![CDATA[dgrid]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=5904</guid>
		<description><![CDATA[<p>Since we last posted an article on Learning Dojo, things have changed dramatically. Dojo has become an early adopter of AMD, with a new build tool to match; there is a new grid; the documentation has been vastly improved, and there are tutorials galore! In fact, there is so much information out there on learning [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>Since we last posted an article on <a href="http://www.sitepen.com/blog/2010/03/05/learning-dojo/">Learning Dojo</a>, things have changed dramatically. Dojo has become an early adopter of <a href="http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/">AMD</a>, with a new build tool to match; there is a <a href="http://www.sitepen.com/blog/2011/10/26/introducing-the-next-grid-dgrid/">new grid</a>; the <a href="http://dojotoolkit.org/reference-guide/1.8/">documentation</a> has been vastly improved, and there are <a href="http://dojotoolkit.org/documentation/">tutorials</a> galore!</p>
<p>In fact, there is so much information out there on learning Dojo, it might be overwhelming. In a way, Dojo 1.7&#8242;s migration to AMD amplifies the problem, in that many previously-published articles no longer reflect the most recent best practices. This post aims to start you off on the right foot by pointing to relevant up-to-date resources for getting started with &mdash; or catching up on &mdash; Dojo 1.8.</p>
<h2>Why Dojo</h2>
<p><a href="http://net.tutsplus.com/tutorials/javascript-ajax/10-reasons-why-your-projects-should-use-the-dojo-toolkit/">10 Reasons your Projects Should use the Dojo Toolkit</a><br />
<a href="http://www.slideshare.net/sitepen/dojo-20-modular-mobile-and-reinventing-web-app-development">Slides: Dojo 2.0: Modular, Mobile, and Reinventing Web App Development</a><br />
<a href="http://net.tutsplus.com/articles/interviews/an-interview-with-dojo-toolkit-creator-dylan-schiemann/">Interview with Dojo Toolkit Co-creator Dylan Schiemann</a></p>
<h2>Getting Started</h2>
<p><a href="http://dojotoolkit.org/documentation/tutorials/1.8/start/">Tutorial: Dojo Start</a> &#8211; Answers many common questions asked by newcomers<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/hello_dojo/">Tutorial: Hello Dojo</a> &#8211; Guides through the first steps in exploring Dojo</p>
<h2>Transitioning from Dojo 1.6</h2>
<p><a href="http://dojotoolkit.org/documentation/tutorials/1.8/modern_dojo/">Tutorial: Modern Dojo</a> &#8211; Explains key differences between Dojo before and after 1.7<br />
<a href="http://www.slideshare.net/jthomas/moving-to-dojo-17-and-the-path-to-20">Slides: Moving to Dojo 1.7 and the path to 2.0</a> &#8211; Presents features new to Dojo 1.7 and up</p>
<h2>AMD Resources</h2>
<p><a href="http://dojotoolkit.org/documentation/tutorials/1.8/modules/">Tutorial: Defining Modules</a> &#8211; Explains how to define and load modules, and configure the loader<br />
<a href="http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/">AMD: The Definitive Source</a> &#8211; Explains the reasoning and benefits of AMD<br />
<a href="http://bryanforbes.github.com/amd-commonjs-modules-presentation/2011-10-29/#0">Slides: Modular JavaScript: AMD &#038; CommonJS modules</a> &#8211; Discusses the evolution of AMD<br />
<a href="https://github.com/amdjs/amdjs-api/wiki">AMD API</a> &#8211; Wiki containing AMD API specifications</p>
<h2>Learning Dojo</h2>
<p><a href="http://dojotoolkit.org/documentation/tutorials/1.8/hitch">Tutorial: Making Functions with hitch and partial</a> &#8211; Explains execution context and how to control it<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/declare">Tutorial: Classy JavaScript with dojo/_base/declare</a> &#8211; Explains Dojo&#8217;s chief inheritance mechanism<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/ajax">Tutorial: Ajax with dojo/request</a> &#8211; Introduces Dojo 1.8&#8242;s new Ajax API<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/deferreds/">Tutorial: Getting Started with Deferreds</a> &#8211; Introduces Deferreds, crucial for asynchronous logic<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/promises/">Tutorial: Dojo Deferreds and Promises</a> &#8211; Discusses Promises and their relation to Deferreds<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/intro_dojo_store">Tutorial: Dojo Object Stores</a> &#8211; Explains the dojo/store API, new since Dojo 1.6<br />
<a href="http://dojotoolkit.org/reference-guide/1.8/dojo/">Reference Guide: Dojo</a> &#8211; Index of reference material for the Dojo package</p>
<h2>Learning Dijit</h2>
<p><a href="http://dojotoolkit.org/documentation/tutorials/1.8/understanding_widgetbase">Tutorial: Understanding _WidgetBase</a> &#8211; Details the module forming the basis of all widgets<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/dijit_layout">Tutorial: Layout with Dijit</a> &#8211; Discusses Dijit&#8217;s layout widgets<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/templated">Tutorial: Creating Template-based Widgets</a> &#8211; Describes Dijit&#8217;s templating capabilities<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/recipes/custom_widget">Recipe: Creating a Custom Widget</a> &#8211; Walks through implementing a widget<br />
<a href="http://dojotoolkit.org/reference-guide/1.8/dijit/">Reference Guide: Dijit</a> &#8211; Index of reference material for the Dojo package</p>
<h2>Developing Applications</h2>
<p><a href="http://dojotoolkit.org/documentation/tutorials/1.8/hash">Tutorial: Using dojo/hash and dojo/router</a> &#8211; Discusses Dojo&#8217;s utilities for managing the browser hash<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/recipes/app_controller">Recipe: Application Controller</a> &#8211; enumerates an approach to writing a small app<br />
<a href="https://github.com/csnover/dojo-boilerplate">Dojo Boilerplate</a> &#8211; Provides a starting point for creating a Web application with Dojo<br />
<a href="http://dojotoolkit.org/documentation/tutorials/1.8/mobile/tweetview/getting_started">Tutorial: Getting Started with dojox/mobile</a> &#8211; The first in a series of tutorials to build a mobile app</p>
<h2>Build Tool Resources</h2>
<p><a href="http://dojotoolkit.org/documentation/tutorials/1.8/build">Tutorial: Creating Builds</a> &#8211; Thoroughly explains the various facets of a custom build<br />
<a href="http://www.sitepen.com/blog/2012/08/27/working-with-dojo-and-amd-in-production/">Working with Dojo and AMD in Production</a> &#8211; Enumerates approaches to loading production builds<br />
<a href="http://dojotoolkit.org/reference-guide/1.8/build/index.html">Reference Guide: The Dojo Build System</a> &#8211; Definitive documentation on the new build system<br />
<a href="http://build.dojotoolkit.org/">Dojo Web Builder</a> &#8211; An online tool for creating Dojo builds</p>
<h2>Dojo Packages</h2>
<p><a href="http://www.sitepen.com/blog/2011/07/25/dojo-foundation-packages/">Dojo Foundation Packages</a> &#8211; Explains the role packages play in Dojo&#8217;s future<br />
<a href="http://dgrid.io">dgrid</a> &#8211; Web site for dgrid, a Dojo Foundation package</p>
<h2>Community</h2>
<p>As always, the Dojo community is the best around.  If you get stumped or have an advanced question, you can get more answers by leveraging the following resources:</p>
<ul>
<li><a href="http://www.dojotoolkit.org/community/">Dojo Community</a>, including a forum interface to the dojo-interest mailing list</li>
<li><a href="http://mail.dojotoolkit.org/mailman/listinfo">Mailing Lists</a></li>
<li><a href="http://www.dojotoolkit.org/chat/">Web client for the #dojo IRC channel on irc.freenode.net</a></li>
</ul>
<p>If you find that a self-guided tour or community support is inadequate, SitePen also offers <a href="http://www.sitepen.com/services/training.php">workshops</a> taught by Dojo experts, as well as highly responsive <a href="http://www.sitepen.com/services/support.php">support services</a>.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/12/06/learning-dojo-1-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Dojo and AMD in Production</title>
		<link>http://www.sitepen.com/blog/2012/08/27/working-with-dojo-and-amd-in-production/</link>
		<comments>http://www.sitepen.com/blog/2012/08/27/working-with-dojo-and-amd-in-production/#comments</comments>
		<pubDate>Mon, 27 Aug 2012 13:17:33 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[AMD]]></category>
		<category><![CDATA[dgrid]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Support]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[amdjs]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=5040</guid>
		<description><![CDATA[<p>In our recent post on dgrid and Dojo Nano, we showed a technique of using nested require statements in order to make use of optimized layers using the Dojo build system. As a refresher, a layer is Dojo&#8217;s terminology for a file that combines many JavaScript resources into a single file. This improves the performance [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>In our recent post on <a href="http://www.sitepen.com/blog/2012/06/11/dgrid-and-dojo-nano-build/">dgrid and Dojo Nano</a>, we showed a technique of using nested require statements in order to make use of optimized layers using the Dojo build system. As a refresher, a layer is Dojo&#8217;s terminology for a file that combines many JavaScript resources into a single file. This improves the performance of your web application by minimizing the number of HTTP requests.</p>
<p>The technique we originally presented was a quick and simple approach:</p>
<pre lang="html">&lt;script type="text/javascript" src="../../dojo/dojo.js"
	data-dojo-config="async: true"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
	require(['dgrid/dgrid'], function () {
	    require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Selection", 
		"dgrid/Keyboard", "dojo/_base/declare", "dgrid/test/data/perf", 
		"dojo/domReady!"],
		function(List, Grid, Selection, Keyboard, declare, testPerfStore){
		//...
</pre>
<p>While this works, it&#8217;s not ideal because you will need to modify your source when switching between development and production environments which is suboptimal. While you could of course fix this with PHP or some other server-side approach for your initial require statement, there are many simple alternative techniques that you can make directly to your markup. Here we explore five other approaches.</p>
<p><span id="more-5040"></span></p>
<h2>Single-layer builds</h2>
<h3>Ideal for: A quick, simple, single-layer application</h3>
<p>In the original blog post, we focused on building simple nano and baseless builds. In this scenario, you may want to just create a custom dojo.js to include all modules that you need. Then we just have the main <code>require()</code> statement with all the <code>dgrid</code> modules. We don&#8217;t need to <code>require()</code> calls to the layer in advance, since the <code>dgrid</code> modules would already be loaded from dojo.js in production. The <code>require()</code> call would just immediately callback since everything the application needs has already loaded.</p>
<h2>Defining a different require module based on the URL</h2>
<h3>Ideal for: Quick and simple approach to loading based on the URL format</h3>
<p>This approach evaluates the application&#8217;s dependencies as a function of the URL. For example, we could test for the word dev in the URL, and only define a dependency on the built dgrid layer when not in a development environment:</p>
<pre lang="javascript">
require(/dev/.test(location.search) ? [] : ['dgrid/dgrid'], function(){
	require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Selection", 
		"dgrid/Keyboard", "dojo/_base/declare", "dgrid/test/data/perf", 
		"dojo/domReady!"],
		function(List, Grid, Selection, Keyboard, declare, testPerfStore){
		//...
	});
});
</pre>
<h2>Configuring layers with <code>deps</code> and <code>callback</code></h2>
<h3>Ideal for: Handling the differences between development and production based on URL or other settings within the dojoConfig object</h3>
<p>Dojo&#8217;s configuration settings allow you to use <code>dojoConfig.deps</code> to load the layer and <code>dojoConfig.callback</code> to start an application:</p>
<pre lang="html" class="highlight:[5,6]">&lt;script type="text/javascript"&gt;
var dojoConfig = {
	async: 1,
	deps: ['dgrid/dgrid'],
	callback: function(){
		require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Selection", 
			"dgrid/Keyboard", "dojo/_base/declare", "dgrid/test/data/perf", 
			"dojo/domReady!"],
			function(List, Grid, Selection, Keyboard, declare, testPerfStore){
			//...
		});
	}
};
&lt;/script&gt;
&lt;/script type="text/javascript" src="../../dojo/dojo.js"&gt;&lt;/script&gt;
</pre>
<p>When the defined dependencies have loaded, a callback function is executed, all of which is defined within the configuration object. We can now evaluate the application&#8217;s dependencies as a function of the URL, similar to the previous example, and then handle the check in the <code>dojoConfig</code> object rather than within a require statement :</p>
<pre lang="html" class="highlight:[4]">&lt;script&gt;
var dojoConfig = {
	async: 1,
	deps: /dev/.test(location.search) ? [] : ['dgrid/dgrid'],
	callback: function(){
		require(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Selection", 
			"dgrid/Keyboard", "dojo/_base/declare", "dgrid/test/data/perf", 
			"dojo/domReady!"],
			function(List, Grid, Selection, Keyboard, declare, testPerfStore){
			//...
		});
	}
};
&lt;/script&gt;
&lt;/script type="text/javascript" src="../../dojo/dojo.js"&gt;&lt;/script&gt;
</pre>
<p>This allows us to vary <code>dojoConfig.deps</code> on a flexible switch. It could be the URL, or a single variable defined at the top of the application&#8217;s markup. We can also define dependencies as a function, with more elaborate criteria for defining the dependencies to load for the application.</p>
<p>The flexibility of this technique makes moving between development, test, and production environments simple and efficient.</p>
<h2>Top level modules</h2>
<h3>Idea for: Larger applications with many dependencies</h3>
<p>Another common approach for a smooth transition between development and production is to create a single top level module per layer that loads all the other modules each application uses. Then the Dojo build tool can be given a single module per layer to create a layer of the same name, so that development and production both load the entry module, as a single dependency in the HTML. This has the added benefit of keeping JavaScript out of your HTML, particularly your dependencies, so you can have a JavaScript-free HTML file.</p>
<p>For example, you might have a file, app/app.js:</p>
<pre lang="javascript">
define(["dgrid/List", "dgrid/OnDemandGrid","dgrid/Selection", "dgrid/Keyboard",
    "dojo/_base/declare", "dgrid/test/data/perf", "dojo/domReady!"],
    function(List, Grid, Selection, Keyboard, declare, testPerfStore){
        //...
});
</pre>
<p>And then, your HTML file would simply contain the following fragment:</p>
<pre lang="html" class="highlight:[4]">&lt;script&gt;
var dojoConfig = {
	async: true,
	deps: ["app/app"]
};
&lt;/script&gt;
&lt;script src="dojo/dojo.js"&gt;&lt;/script&gt;
</pre>
<h2>Dojo Boilerplate</h2>
<h3>Ideal for: Mostly automated approach to following many Dojo best practices for building apps</h3>
<p>The <a href="https://github.com/csnover/dojo-boilerplate">Dojo Boilerplate</a> project will handle this scenario for you automatically. It identifies a few <a href="https://github.com/csnover/dojo-boilerplate#a-brief-tour">Dojo application architecture conventions to follow</a>, and then contains a build script that assists when moving from development to production.</p>
<h2>Conclusion</h2>
<p>As you can see, there are many approaches to simplify your approach for working with Dojo layers in production when using AMD. Let us know in the comments if you have another technique you prefer, or if you have any questions.</p>
<h2>References</h2>
<ul>
<li><a href="http://dojotoolkit.org/reference-guide/1.8/loader/amd.html">Dojo loader reference docs, including details about deps and callback</a></li>
<li><a href="http://dojotoolkit.org/api/1.8/dojo/_base/config">API docs for dojoConfig</a></li>
<li><a href="https://github.com/csnover/dojo-boilerplate">Dojo Boilerplate</a></li>
</ul>
<h2>Help for your application</h2>
<p><a href="http://www.sitepen.com/site/contact.html">Contact us</a> for more information on how we can help you migrate your application to fully leverage AMD. Or, check out our excellent <a href="http://www.sitepen.com/support/index.html">Dojo and JavaScript support services</a>, which can be utilized for working on any AMD-based development project.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/08/27/working-with-dojo-and-amd-in-production/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dojo 1.8 Documentation Highlights</title>
		<link>http://www.sitepen.com/blog/2012/08/16/dojo-1-8-documentation-highlights/</link>
		<comments>http://www.sitepen.com/blog/2012/08/16/dojo-1-8-documentation-highlights/#comments</comments>
		<pubDate>Thu, 16 Aug 2012 16:36:29 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[docs]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[dojo18]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=5111</guid>
		<description><![CDATA[<p>With Wednesday&#8217;s release of Dojo 1.8, there are many exciting improvements to check out! Our top goal for this release was to significantly improve the quality of Dojo&#8217;s documentation. SitePen proudly contributed in the following areas: Helped make many of the more than 500 fixes to our documentation based on community feedback (thank you!) Helped [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>With Wednesday&#8217;s <a href="http://dojotoolkit.org/blog/dojo-1-8-released">release of Dojo 1.8</a>, there are many exciting improvements to check out!</p>
<p>Our top goal for this release was to significantly improve the quality of Dojo&#8217;s documentation. SitePen proudly contributed in the following areas:</p>
<ul>
<li>Helped make many of the more than 500 fixes to our documentation based on community feedback (thank you!)</li>
<li>Helped improve the content found in the <a href="http://dojotoolkit.org/reference-guide/1.8/">reference guide</a></li>
<li>Developed a brand new, extensible JavaScript-based documentation parser, which we use to generate output for the <a href="http://dojotoolkit.org/api/1.8/">API viewer</a></li>
<li>Updated 70% of the existing <a href="http://dojotoolkit.org/documentation/tutorials/1.8/">Dojo tutorials</a> to be accurate for Dojo 1.8. The remainder will be updated in the next few weeks.</li>
<li>Started working on 10 new tutorials, including an updated <a href="http://dojotoolkit.org/documentation/tutorials/1.8/ajax/">Ajax tutorial covering the new dojo/request API for Ajax requests</a>.</li>
</ul>
<p>Thanks for your ongoing suggestions and support. We look forward to your feedback on this release. </p>
<p>From workshops to support to full-scale development, SitePen is the leading industry expert in all things Dojo.  <a href="http://sitepen.com/contact/">Contact us today</a> to discover the best way SitePen can help you upgrade to Dojo 1.8.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/08/16/dojo-1-8-documentation-highlights/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Now Supporting all Major Toolkits!</title>
		<link>http://www.sitepen.com/blog/2012/07/19/now-supporting-all-major-toolkits/</link>
		<comments>http://www.sitepen.com/blog/2012/07/19/now-supporting-all-major-toolkits/#comments</comments>
		<pubDate>Thu, 19 Jul 2012 15:20:25 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[AMD]]></category>
		<category><![CDATA[Cometd]]></category>
		<category><![CDATA[CommonJS]]></category>
		<category><![CDATA[dgrid]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Node.js]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Persevere]]></category>
		<category><![CDATA[Support]]></category>
		<category><![CDATA[backbone]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[support]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=4951</guid>
		<description><![CDATA[<p>We have been providing JavaScript and Dojo support to freelancers, start-ups and Fortune 500 companies for nearly a decade. As we intently watch enterprise organizations everywhere begin to roll out AMD (read about why AMD matters) and the associated code improvements, we are thrilled with the industry&#8217;s direction toward toolkit interoperability! Why? Because! Our masterful [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>We have been providing JavaScript and Dojo support to freelancers, start-ups and Fortune 500 companies for nearly a decade.  As we intently watch enterprise organizations everywhere begin to roll out AMD <a href="http://www.sitepen.com/blog/2012/07/10/amd-for-the-business-side/">(read about why AMD matters)</a> and the associated code improvements, we are thrilled with the industry&#8217;s direction toward toolkit interoperability!  Why?  Because! Our masterful engineering team, consisting of influential members of various open source communities, positions SitePen perfectly to offer full-on, front-end web development support to the world! </p>
<p>Getting right to the point, (<a href="http://www.prnewswire.com/news-releases/sitepen-expands-service-offering-to-popular-javascript-toolkits-163018596.html">The Official Point!</a>), we are pleased to announce the expansion of SitePen Support to officially include more than fifteen popular open-source JavaScript toolkits! </p>
<p><strong>Now supporting the following JavaScript toolkits:</strong></p>
<table style="width:600px;">
<tr>
<td>
<ul>
<li>Dojo</li>
<li>Persevere packages</li>
<li>dgrid</li>
<li>Curl.js</li>
<li>CometD</li>
<li>Twine</li>
</ul>
</td>
<td>
<ul>
<li>jQuery</li>
<li>Backbone</li>
<li>underscore</li>
<li>RequireJS</li>
<li>PhoneGap/Cordova</li>
<li>MooTools</li>
</ul>
</td>
<td>
<ul>
<li>jQueryUI</li>
<li>Wire</li>
<li>Socket.IO</li>
<li>Express</li>
</ul>
</td>
</tr>
</table>
<p>In addition to toolkits, we will continue to support your custom JavaScript source code, as well as key underlying technologies and formats, including JSON, HTML5, WebSockets, SVG/Canvas, Mobile Web, Server-Side JavaScript, AMD, Node.js and many more.</p>
<p>Our expertise with Dojo and advanced JavaScript is relevant for a wide-range of desktop and mobile web application projects and our approach to SitePen Support has always been flexible with the priority being to improve our customers&#8217; web apps.  We strive to support our customers in every way possible and we continue to be Dojo experts. In addition, we&#8217;re now committed to providing your organization with the front-end development expertise that will optimize your application regardless of which toolkits and technologies your company is comfortable using.  You have our word!</p>
<p>Learn More About <a href="http://www.sitepen.com/support/index.html">SitePen Support</a> or <a href="http://www.sitepen.com/site/contact.html">Contact Us </a>to get started today!</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/07/19/now-supporting-all-major-toolkits/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>AMD for the Business-Side</title>
		<link>http://www.sitepen.com/blog/2012/07/10/amd-for-the-business-side/</link>
		<comments>http://www.sitepen.com/blog/2012/07/10/amd-for-the-business-side/#comments</comments>
		<pubDate>Tue, 10 Jul 2012 15:36:05 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[AMD]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[amdjs]]></category>
		<category><![CDATA[modules]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=4773</guid>
		<description><![CDATA[<p>You may have seen our recent blog entitled “AMD: The Definitive Source” which exhaustively explained Asynchronous Module Definition. AMD is a topic with significant technical nuances but the purpose of THIS article is to explain the value of AMD for your business. AMD is an emerging defacto standard for efficiently developing modular JavaScript applications and [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>You may have seen our recent blog entitled “<a href="http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/">AMD: The Definitive Source</a>” which exhaustively explained Asynchronous Module Definition.  AMD is a topic with significant technical nuances but the purpose of THIS article is to explain the value of AMD for your business.</p>
<p>AMD is an emerging defacto standard for <a href="http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/">efficiently developing modular JavaScript applications and libraries</a>. There’s a tremendous amount of business benefit to be achieved from making the switch to AMD for any JavaScript application. If you’re using Dojo 1.7+, you’ve already made the switch and are reaping the rewards as we speak!</p>
<p>Utilizing AMD in your web application dramatically affects code maintainability, application performance and interoperability and these will assuredly result in the following benefits for your business:</p>
<ol style="font-weight: bold;">
<li>Efficient engineering</li>
<li>Improved user experience</li>
<li>Empowered technical leadership</li>
</ol>
<p>Let us tell you how!<br />
<span id="more-4773"></span></p>
<h2>Code Maintainability</h2>
<p>AMD resolves a significant number of issues that occur in JavaScript and HTML5 development projects through its employment of many best practices. JavaScript’s low initial barrier of entry to development often leads to the use of global variables, either intentionally or accidentally. Older versions of Dojo used namespaces, but these are verbose, have an impact on performance and require uniqueness. By following the AMD approach, your team will run into fewer issues and errors when developing.<br />
<span style="color: #588c30; font-weight: bold;">Benefit = Efficient engineering</span></p>
<p>In larger projects and within larger organizations, it is common for different teams to build different portions of an application or library. AMD makes it much easier to share source code between projects and teams, create modules that are more easily reused by different initiatives, and merge work together, saving time and reducing redundant efforts.<br />
<span style="color: #588c30; font-weight: bold;">Benefit = Efficient engineering</span></p>
<p>The AMD module format also encourages development of source code within an architecture that reduces overall development time. By providing developers with a solid model for writing clean, modular source code, fewer errors occur during development, improving time to market while increasing team efficiency.<br />
<span style="color: #588c30; font-weight: bold;">Benefit = Efficient engineering</span></p>
<p>Using an AMD approach through feature detection, it is easier to create versions of your application that are optimized for mobile platforms and to remove legacy browser support for users of modern browsers. Additionally, the logic for such support is stored in an efficient manner making it easier to maintain, and eventually remove when support for legacy browsers is no longer required.<br />
<span style="color: #588c30; font-weight: bold;">Benefit = Efficient engineering AND improved user experience.</span></p>
<h2>Application Performance</h2>
<p>AMD and its associated application optimization tools will lead to smaller source code for your applications, directly improving the performance of your applications. (Read more about the <a href="http://www.stevesouders.com/blog/2009/10/06/business-impact-of-high-performance/">business benefits of improving performance</a>) The result is a reduction in cost for bandwidth, faster page load times and an increase in both satisfied and engaged users. The asynchronous nature of AMD also makes it possible to load modules in parallel, further improving application performance.<br />
<span style="color: #588c30; font-weight: bold;">Benefit = Efficient engineering AND improved user experience.</span></p>
<p>Because of improvements with AMD, a typical Dojo application is now 25-90% smaller in its code base, and load times of 5-10 times faster are not uncommon.</p>
<h2>Interoperability</h2>
<p>When I helped start the Dojo Toolkit, the vision was to create a collection of tools and libraries that would make developers more productive in creating web applications. It was never intended to be a battle between toolkit brands, or an attempt to force users to just use one toolkit and never find inspiration or useful modules from other sources. We’re big believers of having the freedom to choose options that are best for your project.</p>
<p>AMD helps prevent toolkit lock-in by making it far easier to mix and match modules between toolkits and makes it possible to use the dgrid module within a jQuery application or use some MooTools features within a Dojo application.   It is still recommended to exercise caution when loading additional, full toolkits, as this creates some performance overhead. However, by making all of Dojo more modular, you will gain the benefits of microtoolkits while also receiving the benefits of having modules and tools that are tested together, in a manner that meets your expectations and the needs of your applications.<br />
<span style="color: #588c30; font-weight: bold;">Benefit = Empowered Technical Leadership.</span></p>
<p>AMD has already been adopted by many large organizations including IBM, BBC, and Twitter, to name a few. We expect the list of major sites using AMD to grow exponentially this year.</p>
<h2>Summary</h2>
<p>Code maintainability, application performance, and interoperability provide the flexibility to create more dynamic applications. The cost benefits of AMD are driven through these technical and business benefits.</p>
<p>Most companies have one goal in common: <em>Keep customers coming back and do it as efficiently as possible without sacrificing quality.</em> AMD is aligned with this, and we’re excited to see this progress.</p>
<p>When you’re ready to explore your options for leveraging AMD in your web application architecture or if you just have questions about AMD, <a href="http://www.sitepen.com/contact/">contact us</a>.  We’d be delighted to chat with you to see how SitePen can help your organization achieve the results that AMD provides.</p>
<h2>Further Reading</h2>
<ul>
<li><a href="http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/">AMD: The Definitive Source</a></li>
<li><a href="http://www.slideshare.net/sitepen/beyond-dojo-the-rise-of-asynchronous-module-definition-amd-12835213">Beyond Dojo: The Rise of AMD</a></li>
<li><a href="http://blog.responsivenews.co.uk/post/18948466399/cutting-the-mustard">BBC adopting AMD as part of their responsive design efforts</a></li>
<li><a href="http://engineering.twitter.com/2012/05/improving-performance-on-twittercom.html">Twitter article on improving performance, including using AMD</a></li>
</ul>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/07/10/amd-for-the-business-side/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AMD: The Definitive Source</title>
		<link>http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/</link>
		<comments>http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/#comments</comments>
		<pubDate>Mon, 25 Jun 2012 21:29:02 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
				<category><![CDATA[AMD]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[amdjs]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[RequireJS]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=4461</guid>
		<description><![CDATA[<p>So what is AMD? As web applications continue to grow more advanced and more heavily rely on JavaScript, there has been a growing movement towards using modules to organize code and dependencies. Modules give us a way to make clearly distinguished components and interfaces that can easily be loaded and connected to dependencies. The AMD [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<h2>So what is AMD?</h2>
<p>As web applications continue to grow more advanced and more heavily rely on JavaScript, there has been a growing movement towards using modules to organize code and dependencies. Modules give us a way to make clearly distinguished components and interfaces that can easily be loaded and connected to dependencies. The AMD module system gives us the perfect path for using JavaScript modules to build web applications, with a simple format, asynchronous loading, and broad adoption.</p>
<p>The Asynchronous Module Definition (AMD) format is an API for defining reusable modules that can be used across different frameworks. AMD was developed to provide a way to define modules such that they could be loaded asynchronously using  the native browser script element-based mechanism. The AMD API grew out of <a href="http://thread.gmane.org/gmane.comp.web.dojo.devel/10914/focus=11303">discussions in 2009 in the Dojo community</a> which then moved to discussions with CommonJS on how to better adapt the CommonJS module format (used by NodeJS) for the browser. It has since grown into its own standard with its own community. AMD has taken off in popularity, with numerous module loaders and widespread usage. At SitePen we have worked extensively with AMD in Dojo, adding support and now actively building applications with this format.</p>
<p><span id="more-4461"></span></p>
<div style="float: right; width: 250px; background-color: #f6f6f2; border: 1px solid #bbb; font-size: 80%; padding: 1em; margin: 1.5em;">
<h3 style="margin-top: 0.2em; font-size: 1.2em;">Glossary</h3>
<ul style="padding-left: 25px;">
<li style="margin-bottom: 1.2em;"><strong>Module</strong> &#8211; An encapsulated JavaScript file that follows a module format, indicating dependencies and providing exports.</li>
<li style="margin-bottom: 1.2em;"><strong>Module ID</strong> &#8211; This is the unique string that identifies a module. There are relative module ids that resolve to absolute module ids relative to the current module&#8217;s id.</li>
<li style="margin-bottom: 1.2em;"><strong>Module Path</strong> &#8211; This is the URL that is used to retrieve a module. A module id is mapped to the module path based on the loader&#8217;s configuration rules (by default, modules are assumed to be relative to the base path, typically the parent of the module loader package).</li>
<li style="margin-bottom: 1.2em;"><strong>Module Loader</strong> &#8211; This is the JavaScript code that resolves and loads modules and their associated dependencies, interacts with plugins, and handles configuration.</li>
<li style="margin-bottom: 1.2em;"><strong>Package</strong> &#8211; A collection of modules grouped together. For example, dojo, dijit, and dgrid are packages.</li>
<li style="margin-bottom: 1.2em;"><strong>Builder</strong> &#8211; This is  a tool that will generate a concatenated JavaScript file composed of a module (or modules) and its dependencies, thus making it possible to take an application composed of numerous modules and create a number of built layers that can be loaded in a minimal number of HTTP requests.</li>
<li style="margin-bottom: 1.2em;"><strong>Layer</strong> &#8211; A file that contains modules that have been optimized into a single file by a Builder.</li>
<li style="margin-bottom: 1.2em;"><strong>Dependency</strong> &#8211; This is a module that must be loaded for another module to function properly.</li>
<li style="margin-bottom: 1.2em;"><strong>AMD</strong> &#8211; Asynchronous Module Definition, a module format optimized for browser usage.</li>
<li style="margin-bottom: 1.2em;"><strong>Factory</strong> &#8211; The function provided to the module loader via define that is to be executed once all the dependencies are ready</li>
</ul>
</div>
<div>
<h2>Why AMD Modules?</h2>
<p>The basic premise of a module system is to:</p>
<ul>
<li>allow the creation of encapsulated segments of code, called modules</li>
<li>define dependencies on other modules</li>
<li>define exported functionality that can in turn be used by other modules</li>
<li>discreetly access the functionality provided by these modules</li>
</ul>
<p>AMD satisfies this need, and uses a callback function with dependencies as arguments so that dependencies can be asynchronously loaded before the module code is executed. AMD also provides a plugin system for loading non-AMD resources.</p>
<p>While alternate methods can be used to load JavaScript (XHR + eval), using script elements to load JavaScript has an edge in performance, eases debugging (particularly on older browsers), and has cross-domain support. Thus AMD aims to provide an optimal development experience in the browser.</p>
<p>The AMD format provides several key benefits. First, it provides a compact declaration of dependencies. Dependencies are defined in a simple array of strings, making it easy to list numerous dependencies with little overhead.</p>
<p>AMD helps eliminate the need for globals. Each module defines dependencies and exports by referencing them with local variables or return objects. Consequently, modules can define functionality and interact with other modules without having to introduce any global variables. AMD is also &#8220;anonymous&#8221;, meaning that the module does not have to hard-code any references to its own path, the module name relies solely on its file name and directory path, greatly easing any refactoring efforts.</p>
<p>By coupling dependencies with local variables, AMD encourages high-performance coding practices. Without an AMD module loader, JavaScript code has traditionally relied on the nested objects to &#8220;namespace&#8221; functionality of a given script or module. With this approach, functions are typically accessed through a set of properties, resulting in a global variable lookup and numerous property lookups, adding extra overhead and slowing down the application. With dependencies matched to local variables, functions are typically accessed from a single local variable, which is extremely fast and can be highly optimized by JavaScript engines.</p>
<h1>Using AMD</h1>
<p>The foundational AMD API is the <code>define()</code> method which allows us to define a module and its dependencies. The API for writing modules consists of:</p>
<pre>define(dependencyIds, function(dependency1, dependency2,...){
   // module code
});</pre>
<p>The <code>dependencyIds</code> argument is an array of strings that indicates the dependencies to be loaded. These dependencies will be loaded and executed. Once they have all been executed, their export will be provided as the arguments to the callback function (the second argument to <code>define()</code>).</p>
<p>To demonstrate basic usage of AMD, here we could define a module that utilizes the <code>dojo/query</code> (CSS selector query) and <code>dojo/on</code> (event handling) modules:</p>
<pre>define(["dojo/query", "dojo/on"],
        function(query, on){
    return {
        flashHeaderOnClick: function(button){
            on(button, "click", function(){
                query(".header").style("color", "red");
            });
        }
    };
});</pre>
<p>Once dojo/query and dojo/on are loaded (which doesn&#8217;t happen until their dependencies are loaded, and so on), the callback function is called, with the <code>query</code> argument given the export of <code>dojo/query</code> (a function that does CSS selector querying), and the <code>on</code> argument given the export of <code>dojo/on</code> (a function that adds an event listener). The callback function (also known as the module factory function), is guaranteed to be called only once.</p>
<p>Each of the module ids listed in the set of dependencies is an abstract module path. It is abstract because it is translated to a real URL by the module loader. As you can see the module path does not need to include the &#8220;.js&#8221; suffix, this is automatically appended. When the module id starts with a name, this name is considered to be an absolute module id. In contrast, we can specify relative ids by starting with a &#8220;./&#8221; or a &#8220;../&#8221; to indicate a sibling path or parent path, respectively. These are resolved to their absolute module ids  by standard path resolution rules. You can then define a module path rule to determine how these module paths are converted to URLs. By default, the module root path is defined relative to the parent of the module loader package. For example, if we loaded Dojo like (note that we set async to true to enable true async loading of AMD):<br />
<script src="/path/to/dojo/dojo.js"></script><br />
 Then the root path to modules would be assumed to be &#8220;/path/to/&#8221;. If we specified a dependency of &#8220;my/module&#8221;, this would be resolve to &#8220;/path/to/my/module.js&#8221;.</p>
<h2>Initial Module Loading</h2>
<p>We have described how to create a simple module. However, we need an entry point to trigger the chain of dependencies. We can do this by using the <code>require()</code> API. The signature of this function is basically the same as <code>define()</code>, but is used to load dependencies without defining a module (when a module is defined, it is not executed until it is required by something else). We could load our application code like:</p>
<pre lang="html4">	<script src="/path/to/dojo/dojo.js"><!--mce:1--></script>
	<script type="text/javascript"><!--mce:2--></script></pre>
<p>Dojo provides a shortcut for loading an initial module. The initial module can be loaded by specifying the module in the <code>deps</code> configuration option:</p>
<pre lang="html4">	<script src="/path/to/dojo/dojo.js"><!--mce:3--></script></pre>
<p>This is an excellent way of loading your application because JavaScript code can be completely eliminated in HTML, and only a single script tag is needed to bootstrap the rest of the application. This also makes it very easy to create aggressive builds that combine your application code and dojo.js code in a single file without having to alter the HTML script tags after the build. RequireJS and other module loaders have similar options for loading the top level modules.</p>
<div style="margin: 1.5em 0;"><a href="http://www.sitepen.com/blog/wp-content/uploads/2012/06/module-loading1.png"><img class="alignleft size-full wp-image-4818" style="width: 500px;" title="module loading" src="http://www.sitepen.com/blog/wp-content/uploads/2012/06/module-loading1.png" alt="" /></a></div>
<p>The progression of dependency loading from the <code>require()</code> call to the modules is illustrated in the diagram above. The <code>require()</code> call kicks off the loading of the first module, and dependencies are loaded as needed. Modules that are not needed (&#8220;module-d&#8221; in the diagram) are never loaded or executed.</p>
<p>The <code>require()</code> function can also be used to configure the module path look-ups, and other options, but these are generally specific to the module loader, and more information on configuration details are available in each loader&#8217;s documentation.</p>
<h2>Plugins and Dojo Optimizations</h2>
<p>AMD also supports plugins for loading alternate resources. This is extremely valuable for loading non-AMD dependencies like HTML snippets and templates, CSS, and internationalized locale-specific resources. Plugins allow us to reference these non-AMD resources in the dependency list. The syntax for this is:</p>
<pre>"plugin!resource-name"</pre>
<p>A commonly used plugin is the <code>dojo/text</code> plugin which allows you to directly load a file as text. With this plugin, we list the target file as the resource name. This is frequently used by widgets to load their HTML template. For example, with Dojo we can create our own widget like this:</p>
<pre>define(["dojo/_base/declare", "dijit/_WidgetBase", "dijit/_TemplatedMixin", "dojo/text!./templates/foo.html"],
        function(declare, _WidgetBase, _TemplatedMixin, template){
    return declare([_WidgetBase, _TemplatedMixin], {
        templateString: template
    });
});</pre>
<p>This example is instructive on multiple levels for creating Dojo widgets. First, this represents the basic boilerplate for creating a widget using the Dijit infrastructure. You might also note how we created a widget class and returned it. The <code>declare()</code> (class constructor) was used without any namespace or class name. As AMD eliminates the need for namespaces, we no longer need to create global class names with <code>declare()</code>. This aligns with a general strategy in AMD modules of writing anonymous modules. Again, an anonymous module is one that does not have any hardcoded references to its own path or name within the module itself and we could easily rename this module or move it to a different path without having to alter any code inside the module. Using this approach is generally recommended, however if you will be using this widget with declarative markup, you will still need to include namespace/class names in order to create a namespaced global for Dojo&#8217;s parser to reference in Dojo 1.7. Improvements coming in Dojo 1.8 allow you to use module ids.</p>
<p>There are several other plugins that are included with Dojo that are useful. The <code>dojo/i18n</code> plugin is used to load internationalized locale-specific bundles (often used for translated text or regional formatting information). Another important plugin is <code>dojo/domReady</code>, which is recommended to be used as a replacement for dojo.ready. This plugin makes it very simple to write a module that also waits for the DOM to be ready, in addition to all other dependent modules, without having to include an extra callback level. We use <code>dojo/domReady</code> as a plugin, but no resource name is needed:</p>
<pre>define(["dojo/query", "dojo/domReady!"],
        function(query){
   // DOM is ready, so we can query away
   query(".some-class").forEach(function(node){
       // do something with these nodes
   });
});</pre>
<p>Another valuable plugin is <code>dojo/has</code>. This module is used to assist with feature detection, allowing you to choose different code paths based on the presence of certain browser features. While this module is often used as a standard module, providing a <code>has()</code> function to the module, it can also be used as a plugin. Using it as a plugin allows us to conditionally load dependencies based on a feature presence. The syntax for the <code>dojo/has</code> plugin is to use a ternary operator with conditions as feature names and module ids as values. For example, we could load a separate touch UI module if the browser supports touch (events) like:</p>
<pre>define(["dojo/has!touch?ui/touch:ui/desktop"],
  function(ui){
    // ui will be ui/touch if touch is enabled,
    //and ui/desktop otherwise
    ui.start();
});</pre>
<p>The ternary operators can be nested, and empty strings can be used to indicate no module should be loaded.</p>
<p>The benefit of using <code>dojo/has</code> is more than just a run-time API for feature detection. By using <code>dojo/has</code>, both in <code>has()</code> form in your code, as well as a dependency plugin, the build system can detect these feature branches. This means that we can easily create device or browser specific builds that are highly optimized for specific feature sets, simply by defining the expected features with the <code>staticHasFeatures</code> option in the build, and the code branches will automatically be handled correctly.</p>
<h2>Data Modules</h2>
<p>For modules that do not have any dependencies, and are simply defined as an object (like just data), one can use a single argument <code>define()</code> call, where the argument is the object. This is very simple and straightforward:</p>
<pre>define({
    foo: "bar"
});</pre>
<p>This is actually similar to JSONP, enabling script-based transmission of JSON data. But, AMD actually has an advantage over JSONP in that it does not require any URL parameters; the target can be a static file without any need for active code on the server to prefix the data with a parameterized callback function. However, this technique must be used with caution as well. Module loaders always cache the modules, so subsequent <code>require()</code>&#8216;s for the same module id will yield the same cached data. This may or may not be an issue for your data retrieval needs.</p>
<h2>Builds</h2>
<p>AMD is designed to be easily parsed by build tools to create concatenated or combined sets of modules in a single file. Module systems provide a tremendous advantage in this area because build tools can automatically generate a single file based on the dependencies listed in the modules, without requiring manually written and updated lists of script files to be built. Builds dramatically reduce load time by reducing requests, and this is an easy step with AMD because the dependencies are specifically listed in the code.</p>
<h3>Without build</h3>
<p><a href="http://www.sitepen.com/blog/wp-content/uploads/2012/06/waterfall2.png"><img class="alignleft size-full wp-image-4815" title="waterfall2" src="http://www.sitepen.com/blog/wp-content/uploads/2012/06/waterfall2.png" alt="" width="531" height="179" /></a></p>
<h3>With build</h3>
<p><a href="http://www.sitepen.com/blog/wp-content/uploads/2012/06/waterfall3.png"><img class="alignleft size-full wp-image-4816" title="waterfall3" src="http://www.sitepen.com/blog/wp-content/uploads/2012/06/waterfall3.png" alt="" width="533" height="280" /></a></p>
<h2>Performance</h2>
<p>As noted before, using script element injection is faster than alternate methods because it relies more closely on native browser script loading mechanisms. We setup some tests on dojo.js in different modes, and script element loading was about 60-90% faster than using XHR with eval. In Chrome, with numerous small modules, each module was loaded in about 5-6ms, whereas XHR + eval was closer to 9-10ms per module. In Firefox, synchronous XHR was faster than asynchronous, and in IE asynchronous XHR was faster than synchronous, but script element loading is definitely the fastest. It is also surprising that IE9 was the fastest, but this is probably at least partly due to Firefox and Chrome&#8217;s debugger/inspector adding more overhead.<br />
<a href="http://www.sitepen.com/blog/wp-content/uploads/2012/05/module-loading-performance.png"><img class="alignleft size-full wp-image-4552" title="module loading performance" src="http://www.sitepen.com/blog/wp-content/uploads/2012/05/module-loading-performance.png" alt="" /></a></p>
<h2>Module Loaders</h2>
<p>The AMD API is open, and there are multiple AMD module loader and builder implementations that exist. Here are some key AMD loaders that are available:</p>
<ul>
<li><a href="http://dojotoolkit.org/">Dojo</a> &#8211; This is a full AMD loader with plugins and a builder, and this is what we typically use since we utilize the rest of the Dojo toolkit.</li>
<li><a href="http://requirejs.org/">RequireJS</a> &#8211; This is the original AMD loader and is the quintessential AMD loader. The author, James Burke, was the main author and advocate of AMD. This is full-featured and includes a builder.</li>
<li><a href="https://github.com/cujojs/curl">curl.js</a> &#8211; This is a fast AMD loader with excellent plugin support (and its own library of plugins) and its own builder.</li>
<li><a href="https://github.com/zazl/lsjs">lsjs</a> &#8211; An AMD module loader specifically designed to cache modules in local storage. The author has also built an independent optimizer.</li>
<li><a href="https://github.com/gigafied/NeedsJS">NeedJS</a> &#8211; A light AMD module loader.</li>
<li><a href="https://github.com/weepy/brequire">brequire</a> &#8211; Another light AMD module loader.</li>
<li><a href="https://github.com/linkedin/inject">inject</a> &#8211; This was created and is used by LinkedIn. This is a fast and light loader without plugin support.</li>
<li><a href="http://tagneto.blogspot.com/2011/08/almond-small-amd-shim-loader.html">Almond</a> &#8211; This is a lightweight version of RequireJS.</li>
</ul>
<h2>Getting AMD Modules</h2>
<p>There is an increasing number of packages and modules that are available in AMD format. The <a href="http://packages.dojofoundation.org/">Dojo Foundation packages site</a> provides a central place to see a list of some of the packages that are available. The <a href="http://github.com/kriszyp/cpm">CPM installer</a> can be used to install any of the packages (along with automatically installing the dependencies) that have been registered through the Dojo Foundation packages site.<br />
<a href="http://www.sitepen.com/blog/wp-content/uploads/2012/05/dfpackages.png"><img class="alignleft size-full wp-image-4546" title="dfpackages" src="http://www.sitepen.com/blog/wp-content/uploads/2012/05/dfpackages.png" alt="" width="485" height="295" /></a></p>
<p>Alternately, James Burke, the author of RequireJS has created <a href="https://github.com/volojs/volo">Volo</a>, a package installer that can be used to easily install packages directly from github. Naturally, you can also simply download modules directly from their project site (on github or otherwise) and organize your directory structure yourself.</p>
<p>With AMD, we can easily build applications with any package, not just Dojo modules. It is also generally fairly simple to convert plain scripts to AMD. You simply add a <code>define()</code> with an empty array, and enclose the script in the callback function. You can also add dependencies, if the script must be executed after other scripts. For example:</p>
<pre>my-script.js:
// add this to top of the script
defined([], function(){
// existing script
...
// add this to the end of script
});</pre>
<p>And we could build application components that pull modules from various sources:</p>
<pre>require(["dgrid/Grid", "dojo/query", "my-script"], function(Grid, query){
    new Grid(config, query("#grid")[0]);
});</pre>
<p>One caveat to be aware of when converting scripts to modules is that if the script has top level functions or variables, these would ordinarily result in globals, but inside of a <code>define()</code> callback they would be local to the callback function, and no globals will be created. You can either alter the code to explicitly create a global (remove the <code>var</code> or <code>function</code> prefix (you would probably want to do this if you need the script to continue working with other scripts that rely on the globals that it produces), or alter the module to return the functions or values as exports and arrange the dependent modules to use those exports (rather than the globals, this allows you to pursue the global-free paradigm of AMD).</p>
<h2>Directly Loading Non-AMD Scripts</h2>
<p>Most module loaders also support direct loading of non-AMD scripts. We can include a plain script in our dependencies, and denote that they are not AMD by suffixing them with &#8220;.js&#8221; or providing an absolute URL or a URL that starts with a slash. The loaded script will not be able to provide any direct AMD exports, but must provide its functionality through the standard means of creating global variables or functions. For example, we could load Dojo and jQuery:</p>
<pre>require(["dojo", "jquery.js"], function(dojo){ // jquery will be loaded as plain script
    dojo.query(...); // the dojo exports will be available in the "dojo" local variable
    $(...);   // the other script will need to create globals
});</pre>
<h2>Keep It Small</h2>
<p>AMD makes it easy to coordinate and combine multiple libraries. However, while it may be convenient to do this, you should exercise some caution. Combining libraries like Dojo and jQuery may function properly, but it adds a lot of extra superfluous bytes to download since Dojo and jQuery have mostly overlapping functionality. In fact, a key part of Dojo&#8217;s new module strategy is to avoid any downloading of unnecessary code. Along with converting to AMD, the Dojo base functionality has been split into various modules that can be individually used, making it possible to use the minimal subset of Dojo that is needed for a given application. In fact, modern Dojo application and component development  (like <a href="http://www.sitepen.com/blog/category/dgrid/">dgrid</a>) often can lead to an entire application that is smaller than earlier versions of Dojo base by itself.</p>
<h2>AMD Objections</h2>
<p>There have been a few objections raised to AMD. One objection is that using the original CommonJS format, from which AMD is somewhat derived, is simpler, more concise, and less error prone. The CommonJS format does indeed have less ceremony. However, there are some challenges with this format. We can choose to leave the source files unaltered and directly delivered to the browser. This requires the module loader to wrap the code with a header that injects the necessary CommonJS variables, and thus relies on XHR and eval. The disadvantages of this approach have already been discussed, and include slower performance, difficult with debugging on older browsers, and cross-domain restrictions. Alternately, one can have a real-time build process, or on-request wrapping mechanism on the server, that essentially wraps the CommonJS module with the necessary wrapper, which actually can conform to AMD. These approaches are not necessarily showstoppers in many situations, and can be very legitimate development approaches. But to satisfy the broadest range of users, where users may be working on a very simple web server, or dealing with cross-browser, or older browsers, AMD decreases the chance of any of these issues becoming an obstacle for the widest range of users, a key goal of Dojo.</p>
<p>The dependency listing mechanism in AMD specifically has been criticized as being error prone because there are two separate lists (the list of dependencies and the callback arguments that define the variables assigned the dependencies) that must be maintained and kept in sync. If these lists become out of sync the module references are completely wrong. In practice, we haven&#8217;t experienced much difficulty with this issue, but there is an alternate way of using AMD that addresses this issue. AMD supports calling <code>define()</code> with a single callback argument where the factory function contains <code>require()</code> calls rather than a dependency list. This actually can not only help mitigate dependency list synchronization issues, but also can make it extremely easy to add CommonJS wrappers, since the factory function&#8217;s body essentially conforms to the CommonJS module format. Here is an example of how to define a module with this approach:</p>
<pre>define(function(require){
    var query = require("dojo/query");
    var on = require("dojo/on");
    ...
});</pre>
<p>When a single argument is provided, require, exports and module are automatically provided to the factory. The AMD module loader will scan the factory function for require calls, and automatically load them prior to running the factory function. Because the require calls are directly inline with the variable assignment, I could easily delete one of the dependency declarations without any further need to synchronize lists.</p>
<p>A quick note about the <code>require()</code> API: When <code>require()</code> is called with a single string it is executed synchronously, but when called with an array it is executed asynchronously. The dependent modules in this example are still loaded asynchronously, prior to executing the callback function, at which time dependencies are in memory, and the single string require calls in the code can be executed synchronously without issue or blocking.</p>
<h3>Limitations</h3>
<p>AMD gives us an important level of interoperability of module loading. However, AMD is just a module definition, it does not make any prescriptions on the API&#8217;s that the module create. For example, one can&#8217;t simply ask the module loader for a query engine and expect to return the functionality from interchangeable query modules with a single universal API. There may be benefit to defining such APIs for better module interchange, but that is beyond the scope of AMD. And most module loaders do support mapping module ids to different paths, so it would be very feasible to map a generic module id to different target paths if you had interchangeable modules.</p>
<h3>Progressive Loading</h3>
<p>The biggest issue that we have seen with AMD is not so much a problem with the API, but in practice there seems to be an overwhelming tendency to declare all dependencies up front (and that is all we have described so far in this post, so we are just as guilty!). However, many modules can operate correctly while deferring the loading of certain dependencies until they are actually needed. Using a deferred loading strategy can be very valuable for providing a progressively loaded page. With a progressive loading page, components can be displayed as each one is downloaded, rather than forcing the download of every byte of JavaScript before the page is rendered and usable. We can code our modules in a way to defer loading of certain modules by using the asynchronous require([]) API in the code. In this example, we only load the necessary code for this function to create children container nodes for immediate visual interaction, but then defer the loading of the widgets that go inside the containers:</p>
<pre>// declare modules that we need up front
define(["dojo/dom-create", "require"],
        function(domCreate, require){
    return function(node){
       // create container elements for our widget right away,
       // these could be styled for the right width and height,
       // and even contain a spinner to indicate the widgets are loading
       var slider = domCreate("div", {className:"slider"}, node);
       var progress = domCreate("div", {className:"progress"}, node);
       // now load the widgets, we load them independently
       // so each one can be rendered as it downloads
       require(["dijit/form/HorizontalSlider"], function(Slider){
          new Slider({}, slider);
       });
       require(["dijit/Progress"], function(Progress){
          new Progress({}, progress);
       });
    }
});</pre>
<p>This provides an excellent user experience because they interact with components as they become available, rather than having to wait for the entire application to load. Users are also more likely to feel like an application is fast and responsive if they can see the page progressively rendering.</p>
<h2>require, exports</h2>
<p>In the example above, we use a special dependency &#8220;require&#8221;, which give us a reference to a module-local <code>require()</code> function, allowing us to use a module reference relative to the current module (if you use the global &#8220;require&#8221;, relative module ids won&#8217;t be relative to the current module).</p>
<p>Another special dependency is &#8220;exports&#8221;. With exports, rather than returning the exported functionality, the export object is provided in the arguments, and the module can add properties to the exports object. This is particularly useful with modules that have circular references because the module factory function can start running, and add exports, and another function utilize the factory&#8217;s export before it is finished. A simple example of using &#8220;exports&#8221; in a circular reference:</p>
<pre>main.js:
define(["component", "exports"],
        function(component, exports){
    // we define our exported values on the exports
    // which may be used before this factory is called
    exports.config = {
       title: "test"
    };
    exports.start = function(){
        new component.Widget();
    };
});
component.js:
define(["main", "exports", "dojo/_base/declare"],
        function(main, exports, declare){
    // again, we define our exported values on the exports
    // which may be used before this factory is called
    exports.Widget = declare({
        showTitle: function(){
            alert(main.config.title);
        }
    });
});</pre>
<p>This example would not function properly if we simply relied on the return value, because one factory function in the circular loop needs to execute first, and wouldn&#8217;t be able to access the return value from the other module.</p>
<p>As shown in one of the earlier examples, if the dependency list is omitted, the dependencies are assumed to be &#8220;require&#8221; and &#8220;exports&#8221;, and the <code>require()</code> calls will be scanned, so this example could be written:</p>
<pre>define(function(require, exports){
    var query = require("dojo/query");
    exports.myFunction = function(){
       ....
    };
});</pre>
<h2>Looking Forward</h2>
<p>The EcmaScript committee has been working on adding native module support in JavaScript. The <a href="http://wiki.ecmascript.org/doku.php?id=harmony:modules">proposed addition</a> is based on new syntax in the JavaScript language for defining and referencing modules. The new syntax includes a <code>module</code> keyword for defining modules in scripts, an <code>export</code> keyword defining exports, and an <code>import</code> keyword for defining the module properties to be imported. These operators have fairly straightforward mappings to AMD, making it likely that conversion will be relatively simple. Here is an example of how this might look based upon the current proposed examples in EcmaScript Harmony, if we were to adapt the first example in this post to Harmony&#8217;s module system.</p>
<pre>import {query} from "dojo/query.js";
import {on} from "dojo/on.js";
export function flashHeaderOnClick(button){
    on(button, "click", function(){
       query(".header").style("color", "red");
    });
}</pre>
<p>The proposed new module system includes support for <a href="http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders">custom module loaders</a> that can interact with the new module system, which may also still be used to retain certain existing AMD features like plugins for non-JavaScript resources.</p>
<h1>Conclusion</h1>
<p>AMD provides a powerful module system for browser-based web applications, leveraging native browser loading for fast asynchronous loading, supporting plugins for flexible usage of heterogeneous resources, and utilizing a simple, straightforward format. With great AMD projects like Dojo, RequireJS, and others, the world of AMD is an exciting and growing opportunity for fast, interoperable JavaScript modules.</p>
</div>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/06/25/amd-the-definitive-source/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>18 things to look forward to in Dojo 1.8</title>
		<link>http://www.sitepen.com/blog/2012/06/15/18-things-to-look-forward-to-in-dojo-1-8/</link>
		<comments>http://www.sitepen.com/blog/2012/06/15/18-things-to-look-forward-to-in-dojo-1-8/#comments</comments>
		<pubDate>Fri, 15 Jun 2012 20:03:58 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[dojo 1.8]]></category>
		<category><![CDATA[dojo1.8]]></category>
		<category><![CDATA[dojo18]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=4782</guid>
		<description><![CDATA[<p>After many months of work, Dojo 1.8 Beta is almost here. We expect beta to be ready for use on June 22, 2012, with the final 1.8 release due 4-6 weeks later! dojo/request We&#8217;re very excited about this release for many reasons. For the new features, I&#8217;m most excited about the work led by Bryan [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>After many months of work, Dojo 1.8 Beta is almost here. We expect beta to be ready for use on June 22, 2012, with the final 1.8 release due 4-6 weeks later!</p>
<h2>dojo/request</h2>
<p>We&#8217;re very excited about this release for many reasons. For the new features, I&#8217;m most excited about the work led by Bryan Forbes with dojo/request. This is the third major iteration of how Dojo works with Ajax. The first ever Dojo release, dojo.io.bind, was completed at SXSW in 2005, prior to even our 0.1 release. The second major release, dojo.xhr, was an excellent and performant rethink around Ajax. A lot has changed over the past few years, with the introduction of XHR 2, with our support for Dojo inside Node.js, and a strong desire to create a solid, simple, clean, and highly flexible API for the feature that brought JavaScript into the forefront of web application development in 2004. In 1.8, you can still use dojo.xhr (or dojo/_base/xhr with AMD), as it wraps dojo/request. We&#8217;ll have an in-depth post about dojo/request next week.</p>
<p><img class="alignnone size-full wp-image-4791" style="width: 650px;" title="Dojo 1.8" src="http://www.sitepen.com/blog/wp-content/uploads/2012/06/screenshot-2012-06-15-at-8.33.06-.png" alt="" /></p>
<p>Without further ado, here are 18 things to look forward to in  Dojo 1.8:</p>
<h2>New Features:</h2>
<p>1.  dojo/request, making Ajax far more flexible and powerful, and works inside Node.js<br />
2.  dojo/router, a new component for routing to different client-side “pages”<br />
3.  dojox/Calendar, a feature rich calendar widget<br />
4.  dojox/dgauges, a framework to easily create your own gauges<br />
5.  dojox/treemap, a data visualization widget<br />
6.  dojox/mobile, 28 new mobile widgets including audio, video, grid layout, tree view, and more</p>
<h2>Significant Improvements:</h2>
<p>7.  Automatic and declarative require, making it easier to work with AMD for features defined in markup<br />
8.  dojo/promise was rewritten, making promises and deferreds easier to use and track<br />
9.  dojox/mvc was rewritten, along with a new ToDo demo application<br />
10.  <strong>The API documentation and viewer, and Dojo reference guide are vastly improved for 1.8</strong>. For many users, this will be the most welcome change with Dojo 1.8.<br />
11.  DnD on mobile platforms<br />
12.  Canvas and SVG specific enhancements to GFX, adding significant capabilities</p>
<h2>Noteworthy Enhancements:</h2>
<p>13.  General AMD refinements to improve performance and optimize modules throughout the toolkit<br />
14.  Dijit Select and Tree now connect directly with Dojo Object Store API<br />
15.  Claro&#8217;s gradients are easier to customize through CSS rather than images for non-IE browsers<br />
16.  CometD and Lightstreamer integrations are updated to AMD, and should be downloaded from their projects<br />
17.  General performance improvements to many widgets and to Dojo Charts<br />
18.  A mobile migration assistant from 1.6 or 1.7 to 1.8, to make it easy to migrate through the many mobile improvements</p>
<h2>More Information</h2>
<p>Keep following SitePen on your favorite social network for more Dojo 1.8 updates! We&#8217;ll be blogging regularly between now and the release of Dojo 1.8 to tell you more.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/06/15/18-things-to-look-forward-to-in-dojo-1-8/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>dgrid: Getting down to the nitty griddy</title>
		<link>http://www.sitepen.com/blog/2012/04/24/dgrid-getting-down-to-the-nitty-griddy/</link>
		<comments>http://www.sitepen.com/blog/2012/04/24/dgrid-getting-down-to-the-nitty-griddy/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 15:52:55 +0000</pubDate>
		<dc:creator>Ken Franqueiro</dc:creator>
				<category><![CDATA[dgrid]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[Dojo Grid]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=4175</guid>
		<description><![CDATA[<p>What does dgrid mean to Dojo? dgrid has come to represent and demonstrate the future and power of third-party packages for Dojo. The dgrid package helps to jump-start the repository-centric approach, with parts of DojoX expected to eventually follow suit. It also demonstrates extensive use of the new features and architecture in 1.7 — including [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/griddy1.jpg" alt="Inside dgrid" /></p>
<h2>What does dgrid mean to Dojo?</h2>
<p><a href="http://dgrid.io/">dgrid</a> has come to represent and demonstrate the future and power of third-party packages for Dojo. The dgrid package helps to jump-start the repository-centric approach, with parts of DojoX expected to eventually follow suit. It also demonstrates extensive use of the new features and architecture in 1.7 — including granular dependencies, and the new event mechanism in <code>dojo/on</code> — showing how components can use Dojo 1.7 to create amazingly compact and fast user interfaces.</p>
<p>dgrid has also pointed forward to lighter-weight approaches to widget design, more CSS-centric techniques for styling, better separation of structural and skinning styles, and other innovative techniques that have sparked interest into new ways of working with and on Dojo.</p>
<p>Because dgrid builds upon Dojo under the same licensing, you get all of this innovation while preserving Dojo&#8217;s clean intellectual property, simple integration with other features, high performance, and professional engineering, taking advantage of the many things that make Dojo excellent.</p>
<p><span id="more-4175"></span></p>
<h2>Why another grid?  What about the DojoX Grid and its subclasses (EnhancedGrid, TreeGrid, etc.)?</h2>
<p>While the DojoX Grid was cutting edge for its time (initially released as the TurboAjax Grid for Dojo 0.4 in 2006, then converted for and released with Dojo 1.0 in late 2007), browsers have evolved rapidly since then. In fact, Chrome didn&#8217;t exist until a year after the DojoX Grid was released. Developers were required to support browsers that greatly limited what could be accomplished on the web.</p>
<p>At the time, <code>innerHTML</code> was often far and away the fastest way to generate a DOM structure; IE6&#8242;s DOM methods were (and still are) quite slow. Because of this and the fact that a de facto asynchronous data model for Dojo had not been conceived when the original TurboAjax Grid was written, the DojoX Grid uses a synchronous data rendering model. Although DataGrid does use <code>dojo.data</code> stores, it was implemented as an afterthought, requiring rows to be rendered at least twice for each page of data. In addition, any updates to rows such as row selection, mouseover effects, and data updates caused a row to be completely re-rendered using <code>innerHTML</code>. Using <code>innerHTML</code> also meant that if a developer wanted to change how a row rendered beyond adding CSS classes or inline styles, he or she would need to rewrite significant portions of the string generation methods internal to the DojoX Grid rather than simply modify a DOM node or child nodes.</p>
<p>This reliance on string generation made the DojoX Grid extremely monolithic: because it was so hard to extend, it came with a large number of features built in. Some of the features could be turned off (such as selection and column reordering) or simply not used (sets of columns and sub rows), but the code adding those features to the Grid could not be removed for a lighter build. The developer had access to all of the features of the Grid all of the time, whether he or she wanted them or not.</p>
<p>Because of the nature of rendering using <code>innerHTML</code> using strings and the monolithic approach of the DojoX Grid, extending it meant rewriting large portions of the rendering code to accomplish what you wanted. <code>TreeGrid</code> and <code>EnhancedGrid</code> came along to add trees and other features such as a plugin system, also as afterthoughts. While these new classes added features to the Grid, they were forced to do so via the limited and brittle extension points the Grid already exposed, which meant the new features were brittle as well. At the same time, these new features were only adding to the already large code-base and heavy rendering routines of the Grid.</p>
<h2>What was done to avoid those pain points in dgrid?</h2>
<p>From the start, dgrid was designed to take advantage of the new asynchronous loader in Dojo 1.7 with granular dependencies; this means it only loads the parts of Dojo that it needs. The &#8220;only use what you need&#8221; philosophy was very prevalent <a href="http://www.sitepen.com/blog/2011/08/05/code-design-and-approach-for-the-next-grid/">from the start</a> and led to a very modular (rather than monolithic) design. For instance, if you only need a list of items with no notion of columns at all, the <code>List</code> module alone will give you that.</p>
<pre>require(["dgrid/List", "dojo/dom"], function(List, dom){
    var list = new List({
        ...
    }, dom.byId("list"));
});</pre>
<p>If your list has hundreds of items in it, you may want to use <code>OnDemandList</code> to fetch and render items from a store as the user scrolls.</p>
<pre>require(["dgrid/OnDemandList", "dojo/dom"], function(List, dom){
    var list = new List({
        ...
    }, dom.byId("list"));
});</pre>
<p>Adding row selection, cell selection, or keyboard navigation is as simple as mixing in an object that you explicitly require, meaning you only pay for the features you truly need.</p>
<pre>require([
    "dojo/_base/declare",
    "dgrid/OnDemandList",
    "dgrid/Selection",
    "dgrid/Keyboard",
    "dojo/dom"
], function(declare, List, Selection, Keyboard, dom){
    var MyList = declare([List, Selection, Keyboard]);
    var list = new MyList({
        ...
    }, dom.byId("list"));
});</pre>
<p>With regards to rendering, dgrid was designed to fully rely on DOM-based element creation and manipulation. This gives dgrid the advantage of simple and familiar DOM manipulation when adding or extending features, rather than needing to entirely rewrite portions of the UI using <code>innerHTML</code>.</p>
<p>Events are another area where dgrid greatly improves upon the DojoX Grid components, and furthers the &#8220;only pay for what you need&#8221; mantra.  The <code>dojo/on</code> module, new to Dojo 1.7, can be exercised to its full potential to delegate handlers for only the events that are actually of interest in a particular situation.</p>
<p>dgrid components access data in one of two ways: by passing an array of items to render to the <code>renderArray</code> method, or by providing a store conforming to the Dojo Store API (introduced in Dojo 1.6). Asynchronous data handling was one of the primary concerns of dgrid from the beginning; as a result, it has been designed to natively handle both synchronous and asynchronous data sources.</p>
<pre>require([
    "dgrid/OnDemandList",
    "dojo/store/Memory",
    "dojo/dom"
], function(OnDemandList, Memory, dom){
    var dataList = new OnDemandList({
        ...
    });
    dataList.renderArray([ { name: "foo" } ]);

    var storeList = new OnDemandList({
        store: new Memory({
            data: [ { name: "foo" } ]
        })
    });
});</pre>
<p>Other key advantages of dgrid include:</p>
<ul>
<li>focus on more maintainable stylesheet-based styling rather than inline styles</li>
<li>support for mobile devices</li>
<li>accessibility (a11y)</li>
<li>robust set of features provided via mixins and plugins (tree, editor, drag and drop, pagination, and more)</li>
</ul>
<p>It is important to note that dgrid is built to leverage the latest and greatest developments in Dojo, and thus requires Dojo version 1.7.</p>
<h2>Similarities to DojoX grids</h2>
<p>With the release of the dgrid Beta, now seems an apt time to compare dgrid to the DojoX grids to see what a developer might gain by switching to dgrid.</p>
<p>Firstly, while dgrid and the DojoX grids take different approaches to some things, they do share many similar features in common. The following features are supported by both dgrid and DojoX grids:</p>
<ul>
<li>display, sort, select, and edit in-place thousands of rows of data</li>
<li>instantiate and configure via markup</li>
<li>directly or indirectly select rows or cells</li>
<li>reorder displayed columns using drag and drop</li>
<li>virtual paging (progressive loading during scrolling)</li>
<li>accessibility</li>
<li>internationalization</li>
</ul>
<h2>Differences from DojoX grids</h2>
<p>Even with all of these similar features, there are some key areas where dgrid outshines and outperforms the DojoX grids.</p>
<h3>Data Handling</h3>
<p>DojoX grids all support the Dojo Data API. While this API gives a unified data access pattern, it requires that all property access go through the store which adds extra function calls to an application. In addition, all data fetching was handled through callbacks (including synchronous fetches).</p>
<p>dgrid supports the Dojo Store API. Although it is yet another unified data API, it has some advantages over Dojo Data. First, property access is done as a simple property access on items; this means expensive function calls are not needed to access properties of an item. Second, data fetching routines can return either an immediate object or a promise (or <code>Deferred</code>), depending on whether the operation is synchronous or asynchronous; both of these cases can be handled identically by Dojo&#8217;s <code>when</code> function. Third, several store implementations are provided out of the box in Dojo, and moreover, custom implementations are easy to create.</p>
<p>Additionally, dgrid instances have a <code>renderArray</code> method which takes an array of objects and renders them. This can be a very quick way to render a small amount of data without the overhead of instantiating a store.</p>
<h3>Drag and Drop</h3>
<p>Before the <code>EnhancedGrid</code>, setting up drag and drop for rows in the DojoX grids was an arduous task. Even still, using <code>EnhancedGrid</code> simply for row drag and drop will add a large amount of code on top of <code>DataGrid</code> that may not be needed for a simple list.</p>
<p>dgrid takes a simpler approach: If row drag and drop is needed, simply mix <code>dgrid/extensions/DnD</code> into your dgrid instance constructor and a <code>dojo/dnd/Source</code> will be set up for each instance of the grid. From there, a developer can use the <code>dojo/dnd</code> API to set up drag and drop interaction. This works for both <code>dgrid/List</code> and <code>dgrid/Grid</code> equally: no large subclass of a dgrid class or plugin architecture is needed to use row drag and drop.</p>
<h3>Hierarchical Data</h3>
<p>One of the most demanded features of the DojoX grid has been hierarchical data display. Out of the box, the base grid provided in DojoX does not support displaying data in a tree; in fact, up until Dojo 1.4, the only way to display a tree-like structure was to use a grid within a grid. Once <code>TreeGrid</code> was introduced, a developer had to switch his or her code to use that constructor while also setting up a hierarchical grid layout. Additionally, a <code>TreeStoreModel</code> was required alongside the store.  Since <code>TreeGrid</code> itself extends <code>DataGrid</code>, this means even more code needed to be pulled in for the application, and usage of <code>TreeGrid</code> could prove awkward, especially once any customization was necessary.</p>
<p>Out of the box, dgrid comes with the <code>dgrid/tree</code> column decorator. This means any dgrid instance can display hierarchical data; a developer simply needs to implement the <code>getChildren</code> and <code>mayHaveChildren</code> methods on the store, rather than use a <code>TreeStoreModel</code>.</p>
<h3>Pagination</h3>
<p>While all of the DojoX grids support virtual paging (progressive rendering of rows as the user scrolls), only <code>EnhancedGrid</code> supports traditional paging (navigating pages of data using buttons). However, all dgrid instances can mix in <code>dgrid/extensions/Pagination</code> to give the user a traditional paging model.</p>
<h3>Mobile</h3>
<p>None of the DojoX grids have mobile support. In contrast, dgrid was built from the ground up as a mobile-ready widget and supports mobile platforms out of the box.</p>
<h2>Conclusion</h2>
<p>As you can see, dgrid offers better support out of the box for a variety of features while still keeping your application light. Most features are opt-in and thus only add weight to your application if you specifically include them. By contrast, almost all features of the DojoX grid require a specialized subclass of <code>_Grid</code> which can add features which you may not need in your application.</p>
<p>Be sure to check out our <a href="http://dgrid.io#tutorials">dgrid tutorials</a> to get started with dgrid. If you&#8217;d like to migrate your application from the DojoX grids to dgrid, be sure to have a look at the <a href="https://github.com/SitePen/dgrid/wiki/Migration-API">API comparison</a> and <a href="https://github.com/SitePen/dgrid/wiki/Migration-Examples">usage comparison</a> migration documents.</p>
<p>And as always, SitePen can help you with your migration through either our <a href="http://www.sitepen.com/support/index.html">support services</a> or our <a href="http://www.sitepen.com/development/index.html">development services</a>.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/04/24/dgrid-getting-down-to-the-nitty-griddy/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Decruft. Delight. dgrid Beta Is Here!</title>
		<link>http://www.sitepen.com/blog/2012/04/23/dgrid_beta/</link>
		<comments>http://www.sitepen.com/blog/2012/04/23/dgrid_beta/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 15:50:09 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[dgrid]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=4171</guid>
		<description><![CDATA[<p>Does the code for your grid customizations involve more lines than an Apple product launch? You are not alone, brave developer. We feel your pain &#8211; the type that results from banging your head on a keyboard until the room spins &#8211; and that is why we have an amazing gift for you! Read on&#8230; [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/dgrid_here1.jpg" alt="dgrid beta is here" /><br />
Does the code for your grid customizations involve more lines than an Apple product launch?</p>
<p>You are not alone, brave developer.  We feel your pain &#8211; the type that results from banging your head on a keyboard until the room spins &#8211; and that is why we have an amazing gift for you!   Read on&#8230;</p>
<p>Dojo users and SitePen customers alike have needed a grid since the Dojo Toolkit project began. At first, we and several other companies <a href="http://www.sitepen.com/blog/2007/09/16/the-dojo-grid/">banded together</a> to purchase a non-open source grid. Enter <a href="http://dojotoolkit.org/reference-guide/dojox/grid/DataGrid.html">Dojo DataGrid</a>. We contributed our shiny new code to the Dojo Toolkit for the benefit of everyone and we&#8217;ve spent years maintaining and incrementally improving it in Dojo.  But the web evolved, faster and faster, demanding more functionality, more performance, and more data!  Others tried to keep up as well, enter <a href="http://dojotoolkit.org/reference-guide/dojox/grid/EnhancedGrid.html">EnhancedGrid</a> and <a href="http://dojotoolkit.org/reference-guide/dojox/grid/LazyTreeGrid.html">LazyTreeGrid</a>.  Kudos to everyone for building and contributing to Dojo!</p>
<p>Finally, last year, we took a long, hard look at how our customers were using DataGrid and EnhancedGrid.  We agonized over the time and effort spent developing and maintaining such crucial functionality.  We knew something needed to change. Enough was enough!  Our choice was to attempt a DataGrid refactor or start over.  The SitePen Team spoke: We started over.<br />
<span id="more-4171"></span><br />
To date, we&#8217;ve invested thousands of hours in developing the new dgrid, a grid that goes beyond any other, enabling developers to make awesome things faster than ever.</p>
<p>So, without further ado, we&#8217;re delighted to announce that <a href="http://dgrid.io">dgrid</a>, a new JavaScript component for creating advanced, high performance data grids, is now in Beta!</p>
<h2>Alpha, Beta, and beyond</h2>
<p><img style="float: right; margin: 0 0 1em 1em;" src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/alphabeta.jpg" alt="" />The Alpha release of dgrid represented a baseline which gave a fair indication of its design direction, as well as the types of features it intended to support.  While some modules were in an unfinished or rough state, it was possible to demonstrate and harness their abilities, and we were thrilled to hear from several early adopters who shared some early success stories and feedback.</p>
<p>This Beta release represents the culmination of months of work by the SitePen team to fix bugs and work toward a stable API release. While many companies and individuals have already successfully used alpha versions of dgrid in their production applications, dgrid beta represents the first release of dgrid we know to be feature-complete and API-stable for regular use.</p>
<p>Beyond Beta, we&#8217;re on the path to greatness, most notably finishing work on keyboard accessibility and improving mobile compatibility.  Mobile compatibility, in particular, will be a continued focus for development as the mobile landscape continues to evolve.</p>
<h2>Usability, Portability, Compatibility</h2>
<p>We&#8217;ve designed dgrid with your needs in mind.  First of all, because dgrid is a completely portable AMD package, any application written with AMD can use dgrid—even if the rest of the application isn&#8217;t using Dojo!</p>
<p><strong>As for compatibility, we&#8217;re currently targeting the following desktop browsers:</strong><br />
<img style="float: right; margin: 1.5em 0em 1.5em 1.5em;" src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/browsers1.jpg" alt="" /></p>
<ul>
<li>Firefox ESR and latest release (currently 10 and 11, respectively)</li>
<li>Chrome stable (currently 17)</li>
<li>Internet Explorer 6-9</li>
<li>Safari 5.1</li>
<li>Opera 11.61</li>
</ul>
<p><strong>And the following mobile platforms&#8230;</strong></p>
<ul>
<li>iOS 4.3 and 5</li>
<li>Android 2.3 and 4.0</li>
</ul>
<h2>dgrid&#8217;s Modular Features</h2>
<p>dgrid&#8217;s extremely modular design helps to ensure that core functionality can be easily modified and that extremely small, lightweight grids can be created with minimal effort.  Whereas grid modules like DojoX DataGrid are at least 55KB in compressed size, dgrid starts at just 12KB!  Additionally, dgrid includes a huge number of modular features out-of-the-box, <a href="http://dojofoundation.org/packages/dgrid/#features">rivaling or exceeding</a> nearly every other grid component currently available:</p>
<ul>
<li>Keyboard navigation &amp; ARIA role support for accessibility</li>
<li>i18n support</li>
<li>Asynchronous data retrieval &amp; row rendering</li>
<li>Row &amp; column drag&#8217;n'drop</li>
<li><a href="http://jqueryui.com/themeroller/">jQuery ThemeRoller</a> theme support</li>
<li>Native dojo/store API support</li>
<li>Automatic updates with Observable stores</li>
<li>Inline cell editors, including support for Dijit form widgets as editors</li>
<li>Unlimited-depth tree support</li>
<li>Support for multiple independent column sets</li>
<li>Support for records rendered to multiple rows</li>
<li>Support for custom formatting functions for cell contents</li>
<li>A complete row selection engine, including multi-row and indirect (checkbox-based) selection</li>
<li>Licensed using the same CLA &amp; open-source licensing as the Dojo Toolkit</li>
<li>ColumnHider: Shows and hides columns via a simple menu <strong>(Beta Feature!)</strong></li>
<li>ColumnReorder: Reorders columns in simple layouts using drag&#8217;n'drop <strong>(Beta Feature!)</strong></li>
<li>DijitRegistry: Enables integration with the Dijit registry and other Dijit layout widgets <strong> (Beta Feature!)</strong></li>
<li>Virtual &amp; traditional paging options</li>
<li>Pagination: A UI component that changes the behavior of the grid to with discrete pages rather than virtual scrolling <strong>(Beta Feature!)</strong></li>
</ul>
<h2>dgrid, Where have you been all my life?</h2>
<p><a href="http://dgrid.io/"><img style="float: right; margin: 0.5em 0em 1em 1.5em;" src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/website.jpg" alt="dgrid website" /></a>We really wanted to make sure you didn&#8217;t miss out on this extraordinary opportunity to simplify and improve your ongoing development efforts and application performance.   We knew we need to illustrate how dgrid can be used to create amazing experiences with a minimum amount of effort and convince you that this was the way to go! So, here&#8217;s what we did:</p>
<p>First, we documented the heck out of our code and put in on <a href="https://github.com/SitePen/dgrid">Github</a>. THEN, we wrote some  <a href="https://github.com/SitePen/dgrid/tree/master/test">tests</a> and <a href="http://dojofoundation.org/packages/dgrid/#demos">demos</a> and THEN we created some <a href="http://dojofoundation.org/packages/dgrid/#tutorials"> handy tutorials</a> AND THEN, we gathered everything up, organized it to the nines and put it right here:<br />
<a href="http://dgrid.io/">http://dgrid.io/</a></p>
<h2>Development &amp; Support &#8211; We&#8217;ve got your back</h2>
<p>Wow! Thanks for reading this far! You must be seriously over your current grid fiasco!</p>
<p>We&#8217;re working hard with our customers to replace their massive grid implementations with dgrid and we can do the same for your application!  <a href="https://www.sitepen.com/site/contact.html">Call us today</a> to get on the schedule to receive a full grid migration effort or sign up for one of our valuable <a href="http://www.sitepen.com/support/index.html">SitePen Support</a> plans to keep your developers productive and informed!</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/04/23/dgrid_beta/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
