📜 ⬆️ ⬇️

Review of the new release of the most powerful Ajax library - Dojo Toolkit 1.2

Although our review was a bit late, the original Dojo 1.2 was released in the release version on October 6th, but now we will catch up. And so, the Dojo Toolkit is the most powerful and flexible ajax library of all that is on the market, it is actively developing and has a large community. By the way, this community itself, together with Sitepen, has several more projects, among them Cometd and some other equally interesting ones, which we will tell you about soon. Today, all attention to the flagship product - Dojo 1.2 .

Probably I’ll omit the detailed description of the overall architecture of the framework, it has already been mentioned many times in our other publications , and in this version nothing global has changed, so if you base your application on the 1.1 branch, I think the transition will take place with minimal code changes. But what is new and interesting has appeared - we will now consider.

Dojo core.

The module for working with keyboard events has been updated, now we can intercept keystrokes of any keys, even special ones, and process them in our application, also some bugs have been fixed. The platform detection module has changed - now you need to check individual properties (dojo.isIE, dojo.isFF, dojo.isSafari) to define the platform, similarly done in another framework, our favorite ExtJS. In addition to these major platforms, Dojo supports work (and automatically detects and uses specific code) in the Rhino, Jaxer, Spaydermonkey and, of course, all browser platforms, Adobe Air, and Google Gears support. I note that some components or features are only available on certain platforms, so Dojo first detects globally, running it in a browser environment or in another way.
')
Updated support for multilingual and locale, it turned out that behind the cldr module is hiding data from the Common Locale Data Repository service ( http://unicode.org/cldr ), which provides different language data in Unicode for many languages. Now Dojo uses version 1.6, which has been greatly transformed into the necessary internal format for working with the framework (for more details, see the Readme in the component directory). On the basis of Dojo, many companies are doing serious projects designed for the global market, and localization will be most welcome there.

Significantly changed the module responsible for the configuration at boot ( djConfig.addOnLoad ) and allows you to execute custom code after the framework is initialized, now even if Dojo is loaded after the page loads and allows you to execute both the specified code, functions, and methods of objects — in fact, any possible option can now be used.

The changes also affected the debugging mode, now error trapping (try / catch) works correctly in all modules and callback functions, interrupting the execution of the code for debugging when an error occurs, and if the debugging mode is disabled, the error is sent to the log.

Dijit

In this version, according to the developers, a lot has been done to improve the performance and overall appearance of the visual widgets. Added new properties and methods to facilitate the creation and management of complex interfaces. There are a lot of small changes in the component, but I didn’t notice anything cardinal, except a lot of work on API standardization, for example, a universal way of working with widget attributes .

Dojox

In this component, the largest number of changes and interesting new products. Many changes in the graphing and charting component dojox.Charting , added tooltips, new types of charts, animation support, events - all so that it becomes a full-fledged component among the widgets, allowing you to control all the details and parts of the graphs.

The component for working with the dojox.Color color, which can now convert colors using different color models - RGB, CMYK / CMY and HSL / HSV, was also pleasantly surprised.

dojox.gfx gives us the widest possibilities in terms of working with graphics, now it has the ability to work with vector graphics of the SVG format and, in particular, download and use fonts of this format. Also, the render using the capabilities of the MS Silverlight plugin has been significantly rewritten and does not require third-party libraries now.

Significantly updated component for working with HTML, dojox.html , which now do almost anything with HTML and CSS programmatically, and its capabilities use other components, the same gfx.

The Dojox package contains not only various non-visual components, but also widgets that are not yet included in the standard Dijit package, but which can be useful when creating complex interfaces. Here there is a visual WYSIWYG editor with the ability to create and edit tables and work with loaded images, and a table component ( dojox.Grid ), which has improved significantly from previous versions, has gotten tight integration with components for working with data (dojo.data) and many improvements. Since this is the most frequently used component of complex ajax widgets (not counting editors), the changes will be useful for everyone who uses tables in their applications. Moreover, it is indicated that backward compatibility with previous versions is retained.

By the way, it was announced that in the future, the component for working with images of dojox.image will work with the components of working with data, we will probably be able to load images like other data through the universal API.

Of the other important changes, I would point out only the dojox.xml.widgetParser component, which parses the XML description of the widgets, so you can, in theory, form the interface description on the server side as an XML file and transfer it to the client for rendering. Now the inclusion of the <script> tag for connecting either external files or including executable code directly in the description of the widgets is supported. The rest is small changes and edits, the component for the animation dojox.fx is expanded , a good component dojox.widget.Wizard and other changes appeared.

Many changes in data access components. A powerful dojox.data.JsonRestStore component has appeared to implement working with services via REST / JSON with HTTP support for GET / POST / PUT / DELETE methods. dojox.data.CouchDBRestStore is a component for working with the CouchDB database, a rather interesting project about which we will soon tell. One of the components is responsible for working with GoogleFeedStore, allowing you to use and process different feed formats from Google services. At the same time, work with the search is placed in a separate set of components called GoogleSearchStore , in which there are components for regular search, search for videos, images and other types of search, including little-known ones, for example, Book search. dojox.data.S3Store allows you to work with S3 service from Amazon. You can work with the universal dojox.data.ServiceStore interface with any service, or you can inherit it and describe the component for your own implementation.

The JSON data processing modules have also been significantly expanded - this is more like working with data in the same way as databases. The dojox.json component contains a module for implementing various types of queries to JSONQuery data, tools for describing the data structure and validation of dojox.json.schema . By the way, work with services can occur offline, for this there are special modules dojox.rpc.OfflineRest / dojox.rpc.LocalStorageRest

And now let's take a look at the innovations and extensions that appeared in the 1.2 Dojox branch, some of which are just unique on the market for the AJAX component.

Often, statistics in its usual form is not available for web applications, since all popular counters work with regular websites, but using them as part of complex web applications is very difficult. Now you are building an application based on Dojo, you can use the dojox.analytics.Urchin component, which provides all the capabilities of Google Analytics counter, allowing it to be embedded into all application components, deferred loading and initialization, and other features. Up to the fact that you can insert the counter in any dialog box and track how often and who uses this or that functionality in this window.

dojox.av allows you to use a standard component for working with audio and video data, provides a widget player ( dojox.av.widget.Player ) for playing videos.

If you use Flash, then you probably need a component for conveniently inserting multimedia components, initializing the player, determining the version of the installed Flash component, and, if there is no, correct handling of this situation. There is a built-in dojox.embed component that works with both Flash and QuickTime plugins. Now you can stop using third-party solutions, like the Adobe Flash Detection Kit or SWFObject 2.

Expanded communication capabilities, io module, now you can use the plug-in model to work with other, not standard features now, like new features in IE 8, and also the cross-domain data transfer via the window.name mechanism is implemented.

If you want to use more advanced models for development, try an updated module that implements aspect-oriented programming ( dojox.lang.aspect ), more detailed in this post .

The security module dojox.secure allows you to add built-in validation to objects, allows you to prohibit any page DOM model nodes from changing, change or redefine some objects, and also provides a sandbox for executing code in a strictly controlled area ( dojox.secure.sandbox ) .

For those who use unit testing for web applications, the joy is a component or, rather, an environment for creating tests for interfaces and widgets, DOH , which will bring AJAX application development to a serious level. The doh.robot package allows you to create unit tests for all components (Dojo, Dijit, Dojox), and also provides a recorder ( dojox.robot.recorder ) for recording and performing your actions.

The full changelog of changes is available here .

Yes, this release was quite good, the necessary components in the actual development were added and bugs were fixed. Dojo again kept the bar of the most powerful and functional framework, but you shouldn’t think that it can only be used in complex applications - if you need only a few components, you only use them, the library will automatically load everything you need and it doesn’t affect the loading time pages. The release version 1.2 only managed to get out, and Aptana, the best open source IDE for web development, has already included support for this branch in its environment as a plugin. I also note that the popular Zend Framework PHP framework now also comes with Dojo as an extension of interface functionality, so if such companies have already chosen Dojo as a basis, you may also need to look at its capabilities.

Source: https://habr.com/ru/post/42173/


All Articles