Blog

Jun 17

Local Database Stores

By on June 17, 2014 10:57 am

Modern browsers have powerful new database capabilities that enable applications to store data locally, and perform advanced indexed queries without a network connection. Applications can be built with offline support without any disruption to data interaction, including searching. However, these database capabilities have traditionally been difficult to use across browsers since Safari only supports WebSQL (although version 8 is slated to include IndexedDB support), and Firefox and Internet Explorer only support the W3C’s IndexedDB API (Chrome supports both). And these two interfaces couldn’t be more different, making it very problematic to write applications that work offline on all the major browsers.

But, it is now much easier to access these database capabilities. By taking advantage of the consistency of the Dojo object store implementation, in version Dojo toolkit version 1.10, dojox/store now includes object store implementations for IndexedDB and WebSQL, along with a wrapper that will automatically delegate to the appropriate store implementation based on browser support. With a single common interface, you can retrieve, update, add, and delete objects, and even perform sophisticated queries in exactly the same way with the different underlying storage implementations.

Jun 11

Dojo FAQ: Does Dojo support directives like Angular?

By on June 11, 2014 12:00 pm

DojoFAQ

Most JavaScript frameworks have a mechanism for building reusable UI components that can be instantiated in your application. In AngularJS the reusable UI component is known as a directive. When you define a directive, you are creating a reusable UI component within your application. Angular allows you to declaratively use a directive in your HTML markup.

Dojo has a similar mechanism for creating reusable UI components called Dijits. Dijits can also be used declaratively in HTML and the Dojo parser will instantiate the Dijit for you.

May 14

Dojo FAQ: How can I get a list of all topics registered?

By on May 14, 2014 11:36 am

DojoFAQ

Dojo’s topic module provides a singleton object for application-wide publish/subscribe functionality. Pub/sub is a loosely coupled messaging protocol by design. It is designed for scenarios in which publishers and subscribers do not need to know anything about each other. The entire focus is the message — the publisher sends a message without concern about who receives it, and the subscribers await messages, without concern of the sender.

Pub/sub implementations typically do not provide a list of topics that have been published or subscribed to, and Dojo’s implementation conforms to this standard — there is no built-in mechanism to acquire a list of topics. To provide developers a reference to the topics available in your application you should document them at the system level (a higher level than individual module documentation).

May 8

Dojo FAQ: How does selection work with dgrid?

By on May 8, 2014 12:00 pm

DojoFAQ

dgrid’s Selection mixin

dgrid is SitePen’s lightweight, modular, and easily extensible modern grid component, designed for use with AMD and Dojo. The Selection and CellSelection mixins enable selection of rows or cells, both from mouse or keyboard actions and programmatically. Adding selection functionality to a grid is a simple as mixing in the desired module:

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 23

Dojo FAQ: How can I run Dojo tests locally with Intern?

By on April 23, 2014 1:35 pm

DojoFAQ

Intern provides great tools for testing your application on multiple browsers and OSes. Running tests can sometimes be tricky, though. In particular, testing Dojo-based projects often trips up new users because Intern contains its own copy of Dojo, and the boundaries between this and your project’s Dojo can become blurry. Another area that can be confusing is how to run Intern tests locally rather than on Sauce Labs.

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.

Mar 26

Dojo FAQ: What is the difference between dojo/on and dojo/aspect?

By on March 26, 2014 10:01 am

DojoFAQ

dojo/on and dojo/aspect are two APIs that appear to do similar jobs but actually serve two different purposes. dojo/on is used to setup event listeners for DOM nodes and event-emitting objects. dojo/aspect provides Aspect Oriented Programming facilities so functionality can be run before, after, or around a method call and can even manipulate the input to the original method or the original method’s output.