Dinu
Dinu

Reputation: 9

Upgrade over DOJO JS

I need a difference between DOJO 1.3 and DOJO 1.10.

In my application, we are using 1.3 version so we are planning to use the latest version 1.10. Just I got the 1.10 version from online free download then I compared the source code between the version. I find lot of differences so I'm struck with the upgrade as whether I can replace or I have to re write the code.

I'm not aware of the version in between these. I'm aware of my code level changes in the older version but lagging for replacement.

So any one can suggest me the differences. How I can upgrade my code to the latest?

Thanks in advance :)

Upvotes: 0

Views: 652

Answers (1)

Ken Franqueiro
Ken Franqueiro

Reputation: 10559

Your best resource is going to be the release notes, which exist for each incremental minor release.

In terms of "how to upgrade", that depends on what your ultimate goal is. Dojo for the most part aims to be backwards-compatible, so things should mostly still work. Here are some of the more likely places I can think of for things to incidentally break:

  • Custom widget styles (since some widgets' DOM structures changed, especially circa 1.5-1.7)
  • Custom widget extensions that rely on internal methods
  • Custom build profiles - the build system prior to 1.7 gave people a lot of freedom to do some very unorthodox things, whereas the build system as of 1.7 and later converts all non-AMD modules to AMD, which tends to primarily cause people issues by making globals in those modules no longer global due to enclosing them in a function (but globals in modules should be avoided)

If you are interested in updating your code to make use of features available in later versions of Dojo, here are some examples of primary areas of interest (this is certainly not expected to be an exhaustive list):

  • Swapping the legacy module format (with dojo.provide and dojo.require) with AMD modules, and no longer relying on globals / global namespaces
    • The ultimate goal with converting to AMD should be to enable yourself to add async: true to dojoConfig, which configures the loader to drop backwards-compatible synchronous loading (which is slow) and behave strictly like an AMD loader
  • Updating any data stores to use dojo/store (or even dstore, though only dgrid supports this directly at the moment) instead of dojo/data
  • Updating any asynchronous logic to use the deferred/promise APIs updated in Dojo 1.8 - promises were first introduced to Dojo in 1.5, and they provide a much more stable concept than old pre-1.5 Deferreds (which mutated whenever callbacks were chained, and could be resolved/rejected by anything with a reference to it)
  • Updating XHRs to use dojo/request instead of dojo.xhrGet etc.
  • Updating uses of dojo.connect to use dojo/on for events or dojo/aspect for method join points
  • Updating widgets to call get('foo') and set('foo') (and implementing _getFooAttr and _setFooAttr for custom accessors/mutators) instead of getFoo and setFoo

A few other things worth looking at:

  • The Modern Dojo tutorial explains things that have changed in 1.7+
  • The Builds tutorial provides a thorough (maybe too thorough) guide to how to use/configure the build system
  • The Intro and Advanced AMD tutorials will help if you've never used the AMD format before
  • The dojo-amd-converter project might be worth a test run at least to give you an idea of the types of things to replace to update your code

Upvotes: 2

Related Questions