» tagged pages
» logout

sorted by: recent | see : popular
Content Tagged with Dojo + page

Reinhardt: a Client-side Dispatch Framework

Kevin Dangoor of SitePen has introduced Reinhardt a dispatch engine on the client side:

A typical server-side web framework today includes three main components: a URL dispatching to some controller object scheme, a template engine, and a data mapping facility. Currently in Dojo, you’ll find that the latter two items already exist. dojox.dtl provides the first one, and dojo.data provides the second.

Given that Dojo already offers an implementation of the Django template engine, and that regular expression-based URL dispatch was a good fit for our problem at hand, I decided to base our URL dispatch on the model provided by Django.

You can see an example using the framework which uses these patterns:

JAVASCRIPT:
  1.  
  2. var patterns = reinhardt.urldispatch.patterns("demo.code",
  3.   [/^list\/(\d*)$/, "showMovieList", ["year"]],
  4.   [/^search$/, "search"],
  5.   [/^movie\/(\d+)\/$/, "whatyear", ['id']],
  6.   [/^movie\/([\w ]+)\/$/, "whatyear", ["name"]],
  7.   [/^luke$/, "whatyear", [], {name: "Cool Hand Luke"}]
  8. );
  9.  

To get this all going you do something like this:

JAVASCRIPT:
  1.  
  2. dojo.addOnLoad(
  3.   function() {
  4.     if (!patterns.dispatch()) {
  5.       renderContent("../../default.dtl",
  6.                     {movieCount: demo.database.movies.length});
  7.     }
  8.   }
  9. );
  10.  
  11. function renderContent(templatename, variables) {
  12.   var template = new dojox.dtl.Template(new dojo.moduleUrl("demo",
  13.                                       templatename));
  14.   var context = new dojox.dtl.Context(variables);
  15.   dojo.byId("content").innerHTML = template.render(context);
  16.   pagecount++;
  17.   dojo.byId("pagecount").innerHTML = pagecount;
  18. }
  19.  

Read the full article for details, and download the entire sample, for perusal.

Ajax: Ajaxian

Chofter: search mashup using all things Dojo

Shane O'Sullivan has built a nice search mashup experience called Chofter. It uses all things Dojo, including:

  • Layouts, Dialogs, Menus and ContentPanes for the user interface.
  • dojo.data and dojo.rpc for data transfer.
  • dojox.dtl (Django Templating Library) for transforming search data into visuals.
  • dojo.fx and FisheyeLite for eye candy

Ajax: Ajaxian

Dojo 1.2 Final Release

Pete Higgins released Dojo 1.2 the first version under his command. There are a ton of subtle improvements such as:

New Datastores

  • dojox.data.JsonRestStore
  • dojox.data.CouchDBRestStore
  • dojox.data.GoogleFeedStore: A Google AJAX API powered data store for retrieving RSS and Atom feeds from Google.
  • dojox.data.GoogleSearchStore: Data stores to interface Google's AJAX search services.
  • dojox.data.PersevereStore: dojox.data.PersevereStore is an extension of JsonRestStore to Persevere's special features.
  • dojox.data.S3Store: an extension of JsonRestStore to handle Amazon's S3 service using JSON data

New Projects in DojoX

dojox.analytics.Urchin

  • A Google-analytics helper, which supports lazy-loading the Google Analytics API at any point during a page lifecycle.
  • Allows you to post-onload include Google Analytics helper, and track Ajax-y pages via a simple API, with a very small overhead.

dojox.av

  • New project for Audio/Video elements
  • dojox.av.FLVideo: a player for Flash video files
  • dojox.av.widget.Player: Dijit-based object for playing Flash media

dojox.embed

  • A set of utilities that allow you to load/include Objects such as Flash and Quicktime.
  • dojox.embed.Flash for Flash movies
    • Create proxy information for Flash movies implementing ExternalInterface through dojox.embed.Flash.proxy
  • dojox.embed.Quicktime for Quicktime movies
  • dojox.embed.Object—a Dijit that can be used via markup for any dojox.embed objects available.

dojox.io.windowName

  • Provides secure cross-domain request capability. Sends a request using
    an iframe (POST or GET) and reads the response through the frame's window.name.

dojox.io.xhrPlugins

  • This is a registry for creating alternate XHR handlers, for example
    you can register to use IE8's XDomainRequest or a proxy server to handle
    cross-domain requests.

dojox.lang.aspect

  • dojox.lang.aspect is a new AOP library module for before/around/etc advice and other AOP features.
  • See the blog post for details.

dojox.lang.observable

  • Provides a form of getter/setter support to objects.
    Observable objects can be created such that all property
    reads, writes, and method calls will trigger listener functions
    so that you can create APIs where property interaction can be
    controlled and monitored.
  • This relies on VBScript hacks for IE and is somewhat
    limited in functionality.

dojox.secure.capability

  • This provides object-capability JavaScript validation.
  • This is a validator to run before eval to ensure that a script can't access or
    modify any objects (like global objects) outside of those specifically
    provided to it.

dojox.secure.DOM

  • Provides a DOM facade that restricts access to a specified subtree
    of the DOM.
  • The DOM facade uses getters/setters and lettables to emulate the DOM API.

dojox.secure.sandbox

  • Provides support for loading web pages, JSON, and scripts
    from other domains using XHR (and XHR plugins) with a safe
    subset library and sandboxed access to the DOM.

We updated the Google CDN to point to the new version too, and AOL has done the same.

Ajax: Ajaxian

Dojo Fishtank

Blaine Ehrhart wrote a fun little fish tank using Dojo, as another example of doing animation using JavaScript, which includes the following to give you a taste:

JAVASCRIPT:
  1.  
  2. function playBubble (target,newbubble) {
  3.         var top = parseInt(target.style.top);
  4.         var left = parseInt(target.style.left);
  5.         var rand = 50+Math.round(50*Math.random());
  6.         // Here we detect how far up the page the bubble is so we can fade it out with the dojo.fadeOut function and delete it
  7.         if (top <= 150) {
  8.                 var fadeOut = dojo.fadeOut({
  9.                         node: target,
  10.                         duration: 200,
  11.                         onEnd: function(){dojo._destroyElement(target);}
  12.                 });
  13.                 fadeOut.play();
  14.                 return true;
  15.         }
  16.         // If it's a new bubble then we want to setup it's bubble sequence to go up
  17.         if (newbubble == 1) {
  18.                 var floatUp = dojo.fx.slideTo({
  19.                         node: target,
  20.                         duration: 10000,
  21.                         properties: {
  22.                                 top: {
  23.                                         end:"-200",
  24.                                         unit:"px"
  25.                                 }
  26.                         }
  27.                 });
  28.                 floatUp.play();
  29.         }
  30.         // After many random variables are used you get a very bubbly effect when using dojo.fx.slideTo
  31.         var bubbleEffect = dojo.fx.slideTo({
  32.                 node: target,
  33.                 duration: 1000,
  34.                 properties: {
  35.                         left: {
  36.                                 end:(left%2)?(left-rand):(left+rand),
  37.                                 unit:"px"
  38.                         }
  39.                 },
  40.                 onEnd: function(){playBubble(target);}
  41.         });
  42.         bubbleEffect.play();
  43.         return true;
  44. }
  45.  

Ajax: Ajaxian

OfflineRest: One pattern for offline architecture

Kris Zyp has created OfflineRest, a new module in Dojo 1.2 that allows for a simple offline pattern to building your application.

Dojo 1.2’s new dojox.rpc.OfflineRest module automates the local storage of data and synchronization by leveraging the Dojo Data and REST abstractions. The OfflineRest module augments the JsonRest service in Dojo such that requests are cached in local storage for offline access, and modification requests (put, post, and delete) modify the cache and are recorded for delivery to the server; immediately if online, otherwise when connectivity is restored. Furthermore, JsonRest is the core engine used by JsonRestStore. Consequently, you can simply use the standard Dojo Data API with the JsonRestStore and effortlessly add offline capability with no modifications to your data interaction code. The underlying Rest service automates the handling of caching, storing data locally, and syncing changes. In addition the new OfflineRest module has no dependency on plugins, but rather progressively utilizes offline features that are available, while still operating properly on legacy browsers without offline support.

He has a demo that involves a CRUD system for hiking trails which interestingly asked me for Gears permission, even though it appears that OfflineRest doesn't abstract on top of both Gears and the emerging storage standard, which is something I would like to see, to extend the reach.

JAVASCRIPT:
  1.  
  2. dojo.require("dojox.rpc.OfflineRest");
  3. dojo.require("dojox.data.JsonRestStore");
  4.  
  5. // create a store
  6. trailStore = new dojox.data.JsonRestStore({url:"/Trail"});
  7. dojox.rpc.OfflineRest.addStore(trailStore,"");
  8.  
  9. // data
  10. var item = trailStore.newItem();
  11. trailStore.setValue(item,"foo","bar");
  12.  
  13. // manually observing download changes to force updates
  14. dojo.connect(dojox.rpc.OfflineRest, "downloadChanges", function(){
  15.         .. download changes or refresh the page ..
  16. });
  17.  

Ajax: Ajaxian

Dojo Toolkit 1.2 RC1 is Out!

The Dojo team has put out the much anticipated release candidate for the Dojo Toolkit 1.2. Lots of work has gone into this with new updates and features galore added to this release:

  • 1000+ changes, improvements, and bug fixes since the 1.1.1 release
  • Huge improvements to Dijit include .attr() for getting and setting all attributes, and performance and polish improvements across all widgets
  • The new and greatly improved Dojo Grid, with full dojo.data integration
  • Enhancements to charting including tooltips, animations, events, legends, and several new chart types
  • doh.robot, providing unit testing integration with Selenium and Windmill
  • New features including but not limited to:
    • multi-file uploader
    • refined image widgets (Lightbox, Slideshow, etc.)
    • a fast XML parser
    • many new data stores
    • a faster way to include Google analytics
    • security improvements including windowName and dojox.secure
    • JSON (Path, Query, Referencing, and Schema)

This is only a small subset of the updates included and to really get an idea of the breadth of work gone into this release you need to check out Dojo Toolkit v1.2rc1 Release Notes.

Sitepen founder and Dojo team member Dylan Schiemann had this to say about the new release:

The Dojo Community and Contributors have worked tirelessly for the past 6 months, packing an incredible amount of improvements, performance fixes, enhancements, documentation, and more into this release. It's our most polished, complete, fast, well-documented release ever. I'm fortunate to get to work with such a great community, and I applaud the outstanding effort that has gone into making Dojo extraordinary.

Download Dojo Toolkit v1.2rc1

Ajax: Ajaxian

Dojo: The Definitive Guide; Degradable Reflection Widget

Matthew Russell is blogging and screencasting work from Dojo: The Definitive Guide and has put together a piece on a simple, degradable reflection widget using dojo.gfx:

Reflection has been in vogue for a while now in user interfaces, and it wasn’t long ago that I saw a headline about a JavaScript library that streamlined a number of useful effects such as reflection — but alas, without the benefit of Dojo. Well, being the Dojo fanboy that I am, I immediately started to ponder how to accomplish some of these same effects using the dojox.gfx module, and a couple of hours later, I had prototyped a nice, degradable widget that seemed to do the job. By the way, that’s one of the things I love so much about Dojo: once you have a reasonable grip on it, you seldom, if ever, have to look somewhere else. More times than not, a great deal of your work is already done for you, and you just have to connect some of the dots. Remember: it’s all about the frameworks

But there’s always a catch: in this case it’s that IE users must have Silverlight installed for the widget to work; otherwise, it degrades back to the plain image. The reason is that VML, IE’s default gfx renderer, doesn’t support transparency in gradients. No transparent gradient, no nice fade out effect. Likewise, if JavaScript is not available (honestly, who does that?), it degrades down to the bare image. If you didn’t already know, the gfx module exposes an API that works across browsers by using whatever drawing engine is available. At the moment, renderers are available for canvas, VML, SVG, and Silverlight. That pretty much covers it. Adding support for another one should be straightforward: follow the API guidlines and write it.

The Silverlight requirement is interesting, isn't there a way to use IE behaviours to do a transparent gradient?

Watch the screencast to see it all in action.

Ajax: Ajaxian

Want to Use AIR? Read About the Dojo Toolbox Development Effort First

If you've ever been curious as to what goes into building a Adobe AIR application, then read Kevin Dangoor's account of how the Dojo Toolbox was built:

Building the Dojo Toolbox allowed us to dive into Adobe® AIR™, and to create a blended toolchain of JavaScript, PHP, Python and Rhino (JavaScript on the Java Virtual Machine) for developing an amazing desktop application using open web technologies. Read about how we built the Toolbox and what we really think of AIR.

His explanation provides a nice high-level view of some of the challenges but blends in some granular details to such topics as SQLlite querying and file management.

The second challenge was moving to AIR’s security model. AIR provides two different kinds of sandboxes that code can execute in: the “application” sandbox and the “non-application” sandbox. The windows that you see in the Dojo Toolbox all execute their code in the application sandbox. By AIR’s rules, that means that they’re allowed to access any site on the internet and any files on disk. What that code isn’t allowed to do is dynamically evaluate more JavaScript code.

This is a good read for anyone looking to explore Adobe AIR further and leverage the platform in the future.

Ajax: Ajaxian

Custom fonts thanks to rendering SVG font definitions

Tom Trenka has a fantastic post on custom fonts with dojo.gfx that shows the SVG font definition implementation.

Part one of the article deals with painful, practical issues around the licensing of fonts. Tom discusses the various technical options out there, and then gets to the solution:

In general, the issues surrounding font usage have to do with the ability for someone to visit a web site, grab a specific file, and be able to reuse it without paying for a legitimate copy within any of the most commonly used programs (such as Office). Because of this concern, both the EOT and sIFR techniques work–because the fonts are embedded in a form that is not reusable in a common way.

One approach: the SVG Font Specification

Similarly, the SVG Font specification allows for the same concept—by working with a specific font definition, especially one that can be customized for the specific usage, the spec avoids most of the prickly issues surrounding licensing.

SVG fonts are relatively simple in concept; within the <defs> element, you define the main specifications of a font, and then you include specific glyph definitions. Optionally, you can include character-specific kerning information (the space between letters); some fonts include this type of hinting, and the SVG specification supports it.

JAVASCRIPT:
  1.  
  2. dojo.require("dojox.gfx");
  3. dojo.require("dojox.gfx.VectorText");
  4.  
  5. var myfont = dojox.gfx.getVectorFont(someUri);
  6.  
  7. var s = dojox.gfx.createSurface(someNode, width, height);
  8. var g = s.createGroup();
  9. var phrase = myfont.draw(
  10.     g,
  11.     { text: "The rain in Spain falls mainly on the plain.", align: "middle" },
  12.     { size: "3em" },
  13.     "blue"
  14. );
  15.  

Very impressive. If you are a typography wonk, then you have probably watched Helvetica: The Movie:

Ajax: Ajaxian

Dojo Multifile Uploader with Flash

SitePen continues their work on Deft with a multi-file uploader:

The Dojo Toolkit now has support for multi-file uploads, thanks to the new Deft project. The dojox.form.FileUploader class embeds a hidden SWF file in the page which, when triggered, will open a system dialog that supports multiple file selection, and also file masks, which allows the user to filter their selection by file type.

Better yet, it’s fully degradable. If the user does not have version 9 or greater of the Flash Player installed it can, depending on the options you set, present the user with a standard HTML file input instead (or the option to install the latest Flash Player). The HTML form also supports multiple files, although due to browser restrictions, only one can be selected at a time. But they are all uploaded at once.

A major benefit to developers is the flexibility to supply your own styled upload button. For example, a paperclip icon toolbar button in an email application should not look like the standard file input with a text field followed by a “browse …” button. What inspired this design was working on projects where designers and clients would hand me a specification which would say, “the upload button looks like this“.

To use it? Fairly simple:

JAVASCRIPT:
  1.  
  2. var uploader = new dojox.form.FileInputFlash({
  3.         uploadUrl:"http.localHost/FileUpload.php",
  4.         button:myButton,
  5.         uploadOnChange: false,
  6.         selectMultipleFiles: true,
  7.         fileMask: ["All Images", "*.jpg;*.jpeg;*.gif;*.png"],
  8.         degradable: true
  9. });
  10.  

Want to try it out?

This comes after the YouTube uploader that uses Gears.

Ajax: Ajaxian

The Ajax Experience Framework Summit

We talked a few months ago about something new we're doing at the Ajax Experience this year: the "Framework Summit." Basically, we're providing space for Prototype, jQuery, and Dojo to hold their own half-day events on-site, and these events are free and open to the general public.

Since we announced the summit, the frameworks have created their agendas for their events for their events:

Dojo Developer Day:

- Welcome, Introductions (Alex Russell, Dylan Schiemann)
- Tutorial - Progressive Dojo (Peter Higgins)
- Presentation - DojoX GFX and FX (Matthew Russell)
- Presentation - Secrets of DojoX (Tom Trenka)
- Tutorial - Getting going ... Zend + Dojo (Matthew O'Phinney)
- Tutorial - Dijit Layouts In and Out (Nikolai Onken)
- Tutorial - Reusable code, Widgeting (Peter Higgins)
- Community - Getting Involved (Peter Higgins, Nikolai Onken)
- Lightning Demos - What do you have? Show us.

Prototype Developer Day

- Welcome, Introductions (Prototype Core members)
- Contributing docs (Christophe Porteneuve)
- Contributing code (Andrew Dupont)
- Prototype & Performance
- Extended Q&A (Prototype Core members)

jQuery Developer Day

- State of jQuery (Rey Bango)
- Progressively Enhancing the User Experience Using jQuery (Karl Swedberg)
- An In-Depth Look at jQuery UI (Paul Bakaus)
- jQuery Team Code Review (jQuery Team)

Other Frameworks?

Some have asked why we didn't also include Framework X, Y, and Z at the summit. We have a simple answer: we only had room for three frameworks so we choose the three most popular frameworks (according to every survey we've seen). If the concept is successful this time around, we hope to do it on a bigger scale next year.

Obviously we hope you can make it to the entire Ajax Experience event, but if you can't do that, consider coming to one of the Framework Summit events. See you there!

Ajax: Ajaxian

Nice new Dojo aggregate effects

Dojo has some nice new compound effects in the works. Some of the new effects include block fades, disintergrate, explode, shear, and pinwheel.

Each effect can be tweaked with config such as:

  • The number of rows and columns in which to split the element
  • The distance the pieces travel (as a multiple of the element's respective dimensions)
  • Whether or not to fade the pieces in/out
  • How much the effect should be randomized (a percentage)
  • Whether or not the pieces should appear outside the element's boundaries

You will also see effects that work on the text within divs, as well as pieces of the div itself.

Ajax: Ajaxian

Deft-fully using Dojo and Flex

Tom Trenka of SitePen has created a new top-level Dojo package called Deft which "focuses on ActionScript components created in support of the various projects within the Dojo Toolkit (mostly for DojoX). Deft source files are well organized based in part on the organization of other Dojo Toolkit projects, as well as the package structure required by the Flex compiler. Most Flex applications are based on the Flex AS3 Application class, which forces you to write at least one “controlling” MXML file in order compile your code. Instead of this, Deft components inherit primarily from the Sprite class — which allows you to write pure ActionScript code."

It contains a few goodies in it including the multi-image uploader, and pre-alpha quality support for dojox.gfx. Future plans include support for audio and video. "Hopefully Adobe will continue its current path towards being open source friendly, helping Deft flourish."

The article goes into detail on downloading the Flex SDK so you can build applications with it.

This is an interesting experiment in the melding of Flash and Ajax techniques. I would love to see the Flash player giving us more access via simple JavaScript, so we don't even need to create SWF bridges.

Ajax: Ajaxian

Dojo Grid Widget Updated. Data Integration and Editing Improvements.

Dojo developers will be pleased to read about the recent update to the Dojo grid control. Version 1.2 of the grid control focuses primarily on improving integration with Dojo data stores, improved grid layout handling and providing advanced in-place editing capabilities. The update was fairly extensive forcing the team to rethink the design of the widget and refactor quite a bit of code. As such, the updated version of the grid has been setup as a new control allowing developers to continue to use the older version while being able to take advantage the updated features. This will ensure that applications based on the previous grid control won't break.

The biggest benefit truly is the tighter coupling between the new DataGrid and Dojo's existing dojo.data stores:

In order to use dojo.data stores with the grid in previous releases, you needed the dojox.grid.data.DojoData model which would bridge the gap between the grid and the store. DataGrid has been engineered to remove that bridge. Instead of using stand-alone models to store data for the grid, any dojo.data store that implements the Dojo Data read API can be used. Additionally, DataGrid can use the write and notification API’s if they are available.

For example, the following code will create a new dojo.data store based off of a JSON file from a URL and populate the new DataGrid by passing it as an option to the DataGrid constructor:

JAVASCRIPT:
  1.  
  2. var jsonStore = new dojo.data.ItemFileReadStore({ url: "json/gaskets.json" });
  3.  
  4. var grid = new dojox.grid.DataGrid({
  5.         id: 'grid',
  6.         query: { part_num: '*' },
  7.         store: jsonStore,
  8.         structure: layout
  9. }, 'gridNode');
  10.  

rb_dojo_data.png

Building a solid grid control isn't an easy task and it seems like the Dojo team have done a great job of enhancing their widget.

Ajax: Ajaxian

PubTools Search: Fast client-side searching with Gears

Brad Neuberg has built a very easy to use client side search tool called PubTools Search using Gears. The project is open source and provides a great avenue to share knowledge on Gears itself.

To accompany the code, Brad wrote a detailed article:

Did you know that you can use Gearsto do fast, client-side searching of data, similar to a client-side search engine? Gears bundles Full-Text Search (FTS) abilities right into its local, SQLite database. MySpace, for example, uses this feature with their MySpace Mail application, downloading all of a user's messages for fast, client-side search. Because all of the data is local, you can do nifty things like search over the data in real-time as the user types, something that is much harder if you have to query over the network to a server to do the searching.

Would you like to add the same kind of fast, local searching to your own web page and web applications? This article introduces you to PubTools Search and the Gears features that power it, namely Full-Text Search and Workers. PubTools Search is an open source JavaScript library that drops a client-side search engine right into your page. You configure it with basic HTML plus a list of URLs to index. Once loaded, a search form that uses the local Gears full-text search abilities will appear in your page to quickly and locally search over the documents in real time as a user types into the search field.

Brad sat down with me to discuss the project, some of the best practices, and his use of Dojo.

Ajax: Ajaxian

Offline Access to Dojo Resources

Ever had a situation where you've desperately needed to get API information for your favorite toolkit only to find that the site is offline for some reason? The Dojo Toolbox aims to tackle this through the use of Adobe's AIR runtime. Built using the Dojo framework, the Dojo Toolbox allows for offline viewing of Dojo's API making it easy to have immediate access to the information, internet connection or not.

From search to easy navigation and cross-referencing, the Dojo Toolkit source code documentation can now be viewed everywhere you go. When future versions of the Dojo Toolkit are released, you will have the power to view multiple versions of the API within the Dojo Toolbox. We're also working on allowing you to view documentation for your own source code in a future release!

In addition, the Dojo Toolbox allows you to do custom builds of the Dojo framework as well as get a comprehensive list of learning resources all within the same application. This is a "must-have" for Dojo developers.

Ajax: Ajaxian

Shrinking frameworks; Dojo in 6k

Dojo is a framework that you can bend for your needs. You have very fine grained control on what you want in your base dojo.js, how other components are loaded, and a final custom JavaScript file.

Brad Neuberg showed a project, SearchTools, that added local search via Gears, and had a custom Dojo that wasn't Dojo in a very small package.

Alex Russell has taken this further and explained how he got Dojo to 6k by implementing a stub loader, so many of the functions were lazy loading stubs instead of full method bodies.

His use case was mobile, or small embedded devices in general:

On an iPhone with a clean cache the stubbed-out dojo.js cut in half the time required to load and evaluate. Sure, it’ll take more time on the network when parts of the toolkit are actually used (say, in response to a click event), but for mobile device scenarios, it’s going to be hard to beat the flexibility and speed of the stub loader when pulling Dojo into a page.

The post really wasn't about Dojo per se, but John Resig parsed the sentence: "Even so-called “lightweight” libraries like jQuery" and in one part of a three part post hit back:

The way it's worded you would assume that you were paying a large, up-front, cost to using jQuery when, in fact, there is very little overhead. jQuery has been shown to be the fastest loading JavaScript library for non-cached code and considerably fast for cached code.

If we ignore the frameworks and think of the meta-point it is a lot more interesting.

Ajax: Ajaxian

Dijit Theme Tester

Dijit Theme Test Page

Dojo: del.icio.us tag dojo

Working with Web Services with ease; dojo.data and the WikipediaStore

Revin Guillen has posted about the Dojo dojo.data API and how you can layer access to Web services in a very elegant way.

His example shows building access to Wikipedia (demo):

Dojo recently received a new data store that demonstrates exactly what we want: dojox.data.WikipediaStore. It does just what it sounds like, turning Wikipedia into a simple object you can query from your code. Building it with Dojo’s handy dojox.rpc package makes for a simple, compact, DRY implementation.

In only four steps:

  1. Create the web service object
  2. Declare the new data store, inheriting from ServiceStore
  3. Give it a fetch method
  4. Give it a _processResults method

The service descriptor looks like:

JAVASCRIPT:
  1.  
  2. {
  3.     "SMDVersion": "2.0",
  4.     "id": "http://en.wikipedia.org/w/api.php",
  5.     "description": "Wikipedia API",
  6.  
  7.     transport: "JSONP",
  8.     envelope: "URL",
  9.     additionalParameters: true,
  10.     target: "http://en.wikipedia.org/w/api.php",
  11.     parameters: [
  12.         { name: "format", optional: false, "default": "json" }
  13.     ],
  14.  
  15.     services: {
  16.         query: {
  17.             parameters: [
  18.                 { name: "action", type: "string", "default": "parse" }
  19.             ]