Welcome, guest ( Login )

WikiHome » UsingCompatibilityPackages

UsingCompatibilityPackages

Version 9, changed by jburke@dojotoolkit.org 09/22/2006.   Show version history

Built-in Compatibility Package

NOTE: This section only applies if you are using Dojo 0.3.1. If you are using any other version, see the next section on how to make your own compatibility package.

As Dojo APIs are changed or removed, the old method names or behavior may be moved into a compatibility package. This allows Dojo to stay lean and mean, but still allow you to upgrade to newer releases. To use a compatibility package, specify the compatibility option in djConfig. So, if you are using the 0.3 release, and want to get the 0.2.2 compatibility package, specify:

var djConfig = { compat: "0.2.2" };

This will load the src/compat/0.2.2.js file. To see what functions are part of a compatibility package, see the src/compat directory.

Make Your Own Compatibility Package

If the built-in compatibility packages don't meet your needs, you can try making your own:

  1. Create a package to hold the compatibility methods. For instance, "myproject.compatibility", which would map to myproject/compatibility.js on disk. See the following information about defining packages:
  2. Make sure you do:

    dojo.require("myproject.compatibility");
    as the first require statement AFTER all of the require statements that reference dojo packages, but BEFORE any of your own code or own packages are referenced.
  3. If you are doing a custom build profile, then make sure this package is the first dependency listed AFTER all of the dojo references, but BEFORE any of your own packages. For instance:

    var dependencies = [
    "dojo.event.*",
    "dojo.io.BrowserIO",
    "dojo.xml.Parse",
    "dojo.webui.widgets.*",
    "dojo.webui.DomWidget",
    "dojo.animation.*",

    "myproject.compatibility",

    "myproject.Bar"
    ];
  4. Inside the myproject/compatibility.js file, define the compatibility functions. For instance, if dojo.event.oldMethod was renamed to dojo.event.newMethod, the following could be used in myproject/compatibility.js:

    dojo.event.oldMethod = function(){
    dojo.event.newMethod.apply(dojo.event, arguments);
    }


Attachments (0)

  File By Size Attached Ver.