Blog

Jan 22

The road to Intern 3

By on January 22, 2015 12:38 pm

Intern

We normally try to schedule new minor releases of Intern about once every four to six weeks, but when we are working on a major release, there will often be a larger than usual gap in the release cycle. In order to keep our users informed of what’s going on, we wanted to write about what we’ll be doing over the next six to twelve weeks for Intern 3, during which time there will be no new releases (except for possible critical patch releases).

Jan 21

Dojo FAQ: How can I handle recoverable server errors transparently with dojo/request?

By on January 21, 2015 10:10 am

DojoFAQ

A common scenario with web applications is accessing protected resources, which require authentication with the server in order to proceed. A common flow is as follows:

  1. User opens web site
  2. Web site presents authentication screen
  3. User enters credentials
  4. Web site presents protected information

Authentication workflows

This is simple enough to begin with, but what happens when the session times out? Or perhaps the application does not require authentication initially, but once the user initiates an action to access protected resources authentication is required? A common approach is to use redirects to an authentication page:

Jan 14

Dojo FAQ: Testable store-backed widget

By on January 14, 2015 1:11 pm

DojoFAQ

As object stores are frequently used in Dojo-based applications, developers often ask about a good way to utilize stores in their custom widgets. Here we present a common pattern for doing just that in a two-stage approach, starting simple.

A store-based widget needs two things at minimum: a way to set the store and a way to render items from the store. We start with a mixin that provides those elements. Note that standard documentation is omitted for brevity.

define([
  'dojo/_base/declare',
  'dojo/dom-construct'
], function(declare, domConstruct) {
  return declare(null, {
    store: null,

    _setStoreAttr: function (store) {
      this._set('store', store);

      if (store) {
        this._renderItems(this.store.query({}));
      }
    },

    _renderItems: function (queryResults) {
      queryResults.forEach(function (item) {
        var renderedItem = this._renderItem(item);
        domConstruct.place(
          renderedItem,
          this.containerNode || this.domNode
        );
      }, this);
    },

    _renderItem: function (item) {
      // render the item and return its DOM node
    }
  });
});
Jan 8

Robust JavaScript Application Architecture

By on January 8, 2015 1:11 pm

In October, 2014, I was coerced invited to deliver a talk at the first FullStack conference in London, a conference focused on Node.js, JavaScript and hackable electronics. The conference was an interesting cross-section of all things related to JavaScript.

A topic that’s been on my mind lately is how to choose a robust architecture that’s right for your application. The point of the talk was to encourage people to challenge assumptions and not just choose whatever is popular or whatever they know best. I’m sure some attendees in the audience just wanted to be told which framework to use, but the point was to make people really challenge themselves, and find solutions that work now, but are flexible enough to change later.

The talk is now available online:

JavaScript architecture assistance

JavaScript Application architecture is something we specialize in at SitePen, as we see far too many organizations struggling in this area. If you need assistance, please contact us to talk more about your application and how we can help.

Nov 17

Introducing dstore

By on November 17, 2014 1:24 pm

dstore 1.0

Dojo has long distinguished itself with a robust and complete application architecture. And the foundation of this architecture has been the store interface, providing clean separation and consistent interface between presentation and data sources. We are committed to continuing to improve this architecture, and in this pursuit, we now releasing dstore, a next generation object store interface and set of data modeling components.

dstore is an exciting new package that provides a number of significant improvements over the prior data store framework, including a more fluent querying API, improved event notification, advanced cross-store filtering, and a more modular mixin system that allows us to easily combine components with alternate format support, advanced querying support, and more. In this post, we want take a brief look at these new features and improvements. From there, you can explore the tutorials and documentation that we have written for this new package.

Oct 22

Dojo FAQ: How do I load multiple versions of Dojo on the same page using modern Dojo?

By on October 22, 2014 1:02 pm

DojoFAQ

The way modules are loaded changed with the introduction of modern Dojo (1.7+). Dojo now uses the AMD format for packaging and loading modules within an application. AMD avoids the use of globals, which limits the likelihood of unintended interactions between modules. By leveraging AMD and the flexible configuration provided by the Dojo loader, we can load different versions of the same package on a page without dangerous interactions.

Oct 15

Dojo FAQ: How to use JSFiddle to provide a functioning test case

By on October 15, 2014 9:51 am

DojoFAQ

Making a case

When collaborating with other developers nothing is better for conveying an issue than real, working code. To this end, JSFiddle provides a way to quickly create and share functioning test cases written in HTML, CSS, and JavaScript. It provides a customizable environment with support for Dojo and many other common frameworks, services for mocking Ajax requests, basic change control, and collaboration tools. The interface is simple and gets out of your way allowing you to quickly write your example with little setup.

Sep 12

Intern 2.1 released

By on September 12, 2014 9:06 pm

Today we’re happy to announce the release of Intern 2.1. This release contains several bugfixes and improvements to existing functionality, as well as new features to make running tests and handling test results easier. The full list of enhancements and bugfixes is available in the release notes. Here are some of the highlights!

More output options

Two new reporters have been added to Intern: an HTML reporter for the browser client and a JUnit XML reporter.

The HTML reporter is a new default reporter for Intern’s browser client runner (client.html). It displays at the end of a test run, summarizing the test results and presenting them in an easy-to-read format:

The output of the JUnit reporter, on the other hand, is meant for machine consumption. It aggregates test results and outputs them in a report.xml file that follows generally accepted standards for JUnit-compatible XML. This makes it much easier to plug Intern into tools that accept JUnit reports, like Jenkins.

Sep 9

On YUI, Dojo 2, and long-term JavaScript toolkits

By on September 9, 2014 9:20 am

In late August, YUI surprised the JavaScript world by announcing that, effective immediately, development efforts on YUI have been suspended. YUI was a well respected peer of Dojo over the years, and we were surprised to hear this news from Yahoo. The JavaScript community can be very fickle, with new projects created every day. It’s very easy to create open source software, but it’s difficult to create projects that last.

Aug 27

Dojo FAQ: How can I create dependent or linked select controls using Dijit?

By on August 27, 2014 10:09 am

DojoFAQ

When building a select control in a form there are times where its available options need to change dynamically in response to a change in another control. For instance, a form with both country and state/province select controls might require the options in the state select to change based on the country select’s current selection. This is what we would call a dependent, or linked, select. One way to accomplish this is by watching changes in the selection state of one select and finding and setting the appropriate selection values on the other.

The selection values of Dijit Select widgets can be provided as an array of options objects or a dojo/store instance. We will walk through an example creating a dependent select for both types of source data.