Jun 24

REST tips

By on June 24, 2014 11:50 am

At SitePen, we have long been advocates for building web applications on a RESTful architecture. Over the last several years, it has been exciting to see organizations increasingly provide RESTful endpoints for the Dojo-based front-ends that we support and develop. A well-designed REST backend can be a excellent foundation for manageable, scalable applications, that will be ready to evolve into the future. I wanted to share a few tips for designing a set of RESTful services.

Jun 13

JSConf 2014 Adventures

By on June 13, 2014 12:27 pm

JSConf 2014Warm weather, ocean water, and sunburn. Yes, I just attended a JavaScript conference! JSConf is a three-day conference that has talks by a number of great speakers, split up with a “choose-your-own-adventure” day in the middle. The talks covered a wide variety of topics, from front end tooling to JavaScript robotics.

The first day of the conference had many great talks. The one that stood out the most to me was the User Interface Algorithms talk by Mark DiMarco. He described Voronoi Diagrams and, using The New York Times’ 512 Paths to the White House page, shows how they are used to determine which path to highlight in a tree based on the mouse position. He then examined the Amazon drop-down menu and explained how it knows when to keep submenus open.

May 29

Building on Persevere

By on May 29, 2014 11:11 am

Persevere is a server-side JavaScript framework that we started several years ago to help build RESTful web applications with clean separation of concerns, encapsulation, and the consistency of JavaScript in both client and server. Recently, we had the opportunity to work on a project that used the full capabilities of Persevere, leveraging many of its features and leading to some improvements as well. We wanted to share some insights on how to best leverage some of the unique features of Persevere.

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


AMD: Beyond the Basics

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

], 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.