Blog

May 7

What’s next for Intern

By on May 7, 2014 9:21 am

Our first year of Intern has been a big one! It became a top trending project on GitHub for the month of our first release and has gained over 100 community forks and nearly 1700 stars so far. It’s in use today by tons of companies with names like Alfresco, Esri, IBM, Intuit, Mozilla, and Stripe. Because we believe so strongly in the power of testing, especially as Web applications continue to grow in size and complexity, we’re excited to continue our investment in Intern and its supporting technologies in order to provide the best possible testing experience for all Web developers.

Here’s a look at some of what’s coming to Intern this summer:

Apr 24

Intro to Intern webcast

By on April 24, 2014 5:00 am

Last month, we conducted a live webcast to provide an Introduction to Intern, SitePen’s open source testing framework.

Our webcast covered:

  • An overview of Intern’s numerous functional and unit testing features and capabilities
  • Mocking objects and data
  • Injecting dependencies
  • Troubleshooting
  • Future direction of Intern

While it’s too late to attend this webcast and heckle us with live questions, we recorded the session and have made it available for you online:

We encourage you to use Intern in your current application and then tell us about your experience. You can find us on Stack Overflow where we’re answering questions and, of course, we cover Intern as part of our JavaScript support and as a topic in our Dojo workshops. If you’d like more information about having SitePen assist your organization with implementing and refining your process for JavaScript testing, please let us know.

Apr 11

Extension Events

By on April 11, 2014 9:41 am

When working in an event-driven environment such as the web, it is important to utilize tools that allow you to create succinct, easy-to-read code that’s extensible and flexible. One great mechanism that Dojo provides is the ability to use extension events.

What Are They?

Extension events are functions that are passed in lieu of an event type to dojo/on. The extension event function should accept a DOM node and an event listener. The function should encapsulate any logic related to the node and invoke the listener when appropriate. The most common case is adding a listener to a native DOM event (click, mouseover, etc.) with custom logic included that determines whether the handler is called or not.

Feb 25

Dojo FAQ: How can I conditionally load AMD modules?

By on February 25, 2014 7:31 pm

DojoFAQ

AMD: Beyond the Basics

If you’ve been using Dojo 1.7+, you know the basic method of loading modules with AMD:

require([
	'dojo/dom',
	'dojo/query'
], function (dom, query) {
	// dojo/dom and dojo/query modules are 
	// loaded and available for use
});

There are times when you may not know the specific modules you want to load during development. There are a few approaches that can be used to determine which modules to load dynamically at run-time.

Feb 13

Creating Dojo Widgets with Inline Templates

By on February 13, 2014 11:58 am

Many Dojo widgets make use of client-side templating for generating the UI. Template HTML files are brought in to the page with dojo/text, parsed and converted to DOM nodes, and placed on the page, allowing our code to make substitutions, instantiate widgets within the template, and hook up events and attach points. However, we may find ourselves dealing with markup generated on the server and delivered on the page that we want to enhance with Dojo. Luckily, it is quite simple to make a custom widget that uses its source node as the template, allowing us to use markup already on the page as the template for our widget.

Jan 6

Private Matters: Convention and Closures

By on January 6, 2014 11:10 am

Many object-oriented programming (OOP) languages provide a way to define private properties and methods. This allows objects to encapsulate functionality and state information. This encapsulation leads to a clear distinction between the internal implementation and a clean external interface.

However, JavaScript does not have a native mechanism for declaring private properties and methods, in the same sense that other object oriented languages do. But, there are a few techniques that we can use to achieve the same results.

Dec 31

The Definitive TypeScript Guide

By on December 31, 2013 3:19 pm

This article describes the features and functionality of TypeScript 1.0.

One of the newest and most interesting languages for large-scale RIA development is Microsoft’s TypeScript. TypeScript’s claim to fame is that it adds optional static typing and class-based OOP to JavaScript. In comparison to similar languages like CoffeeScript and Dart, TypeScript is unique because it is written as a superset of JavaScript—in other words, all JavaScript is already TypeScript. The language and compiler are open source and written in JavaScript, and the TypeScript team have taken great care to align the language’s extra features as closely as possible with what’s coming in EcmaScript 6, so it also provides developers with an easy path to start using some of these newer language features.

On the downside, TypeScript’s documentation currently consists of a few simple demos and a 148-page language specification—hardly an easy or friendly way to get started with such an exceptional language. This blog post aims to provide a complete guide for new and existing users of TypeScript, assuming you already have a reasonable knowledge of JavaScript and a basic understanding of how class-based inheritance works (as in Java, PHP, C#, etc.).

Dec 4

Persevere on Heroku

By on December 4, 2013 9:52 am

It is becoming increasingly popular to deploy Node.js-based applications to Node-friendly hosting services to take advantage of the pre-built, reliable, robust architecture and infrastructure these services provide. Persevere, a JavaScript server framework for developing RESTful applications on Node.js, is an excellent fit for these types of hosting services. In this post I will show you how easily a Persevere application can be built and deployed on one such service, Heroku, but the process can be easily replicated on other providers that offer similar functionality.

Dec 7

AMD Module and Local Variable Naming Conventions

By on December 7, 2012 1:33 am

Client-Side web application development is becoming more and more robust. There are many amazing tools and technologies available for creating an immersive and interactive user experience. With the demand from users rising, the importance of creating code efficiently is paramount. When working with Dojo and other AMD compatible tools, you can easily harness the power of writing very modular source code. Two common challenges you might face when working with AMD are choosing meaningful names for your modules and determining naming conventions for local variable references to your modules.