| 1 | The Dojo Toolkit |
|---|
| 2 | ---------------- |
|---|
| 3 | |
|---|
| 4 | Dojo is a portable JavaScript toolkit for web application developers and |
|---|
| 5 | JavaScript professionals. Dojo solves real-world problems by providing powerful |
|---|
| 6 | abstractions and solid, tested implementations. |
|---|
| 7 | |
|---|
| 8 | Getting Started |
|---|
| 9 | --------------- |
|---|
| 10 | |
|---|
| 11 | To use Dojo in your application, download one of the pre-built editions from the |
|---|
| 12 | Dojo website, http://dojotoolkit.org. Once you have downloaded the file you will |
|---|
| 13 | need to unzip the archive in your website root. At a minimum, you will need to |
|---|
| 14 | extract: |
|---|
| 15 | |
|---|
| 16 | src/ (folder) |
|---|
| 17 | dojo.js |
|---|
| 18 | iframe_history.html |
|---|
| 19 | |
|---|
| 20 | To begin using dojo, include dojo in your pages by using: |
|---|
| 21 | |
|---|
| 22 | <script type="text/javascript" src="/path/to/dojo.js"></script> |
|---|
| 23 | |
|---|
| 24 | Depending on the edition that you have downloaded, this base dojo.js file may or |
|---|
| 25 | may not include the modules you wish to use in your application. The files which |
|---|
| 26 | have been "baked in" to the dojo.js that is part of your distribution are listed |
|---|
| 27 | in the file build.txt that is part of the top-level directory that is created |
|---|
| 28 | when you unpack the archive. To ensure modules you wish to use are available, |
|---|
| 29 | use dojo.require() to request them. A very rich application might include: |
|---|
| 30 | |
|---|
| 31 | <script type="text/javascript" src="/path/to/dojo.js"></script> |
|---|
| 32 | <script type="text/javascript"> |
|---|
| 33 | dojo.require("dojo.event.*"); // sophisticated AOP event handling |
|---|
| 34 | dojo.require("dojo.io.*"); // for Ajax requests |
|---|
| 35 | dojo.require("dojo.storage.*"); // a persistent local data cache |
|---|
| 36 | dojo.require("dojo.json"); // serialization to JSON |
|---|
| 37 | dojo.require("dojo.dnd.*"); // drag-and-drop |
|---|
| 38 | dojo.require("dojo.lfx.*"); // animations and eye candy |
|---|
| 39 | dojo.require("dojo.widget.Editor2");// stable, portable HTML WYSIWYG |
|---|
| 40 | </script> |
|---|
| 41 | |
|---|
| 42 | Note that only those modules which are *not* already "baked in" to dojo.js by |
|---|
| 43 | the edition's build process are requested by dojo.require(). This helps make |
|---|
| 44 | your application faster without forcing you to use a build tool while in |
|---|
| 45 | development. See "Building Dojo" and "Working From Source" for more details. |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | Compatibility |
|---|
| 49 | ------------- |
|---|
| 50 | |
|---|
| 51 | In addition to it's suite of unit-tests for core system components, Dojo has |
|---|
| 52 | been tested on almost every modern browser, including: |
|---|
| 53 | |
|---|
| 54 | - IE 5.5+ |
|---|
| 55 | - Mozilla 1.5+, Firefox 1.0+ |
|---|
| 56 | - Safari 1.3.9+ |
|---|
| 57 | - Konqueror 3.4+ |
|---|
| 58 | - Opera 8.5+ |
|---|
| 59 | |
|---|
| 60 | Note that some widgets and features may not perform exactly the same on every |
|---|
| 61 | browser due to browser implementation differences. |
|---|
| 62 | |
|---|
| 63 | For those looking to use Dojo in non-browser environments, please see "Working |
|---|
| 64 | From Source". |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | Documentation and Getting Help |
|---|
| 68 | ------------------------------ |
|---|
| 69 | |
|---|
| 70 | Articles outlining major Dojo systems are linked from: |
|---|
| 71 | |
|---|
| 72 | http://dojotoolkit.org/docs/ |
|---|
| 73 | |
|---|
| 74 | Toolkit APIs are listed in outline form at: |
|---|
| 75 | |
|---|
| 76 | http://dojotoolkit.org/docs/apis/ |
|---|
| 77 | |
|---|
| 78 | And documented in full at: |
|---|
| 79 | |
|---|
| 80 | http://manual.dojotoolkit.org/ |
|---|
| 81 | |
|---|
| 82 | The project also maintains a JotSpot Wiki at: |
|---|
| 83 | |
|---|
| 84 | http://dojo.jot.com/ |
|---|
| 85 | |
|---|
| 86 | A FAQ has been extracted from mailing list traffic: |
|---|
| 87 | |
|---|
| 88 | http://dojo.jot.com/FAQ |
|---|
| 89 | |
|---|
| 90 | And the main Dojo user mailing list is archived and made searchable at: |
|---|
| 91 | |
|---|
| 92 | http://news.gmane.org/gmane.comp.web.dojo.user/ |
|---|
| 93 | |
|---|
| 94 | You can sign up for this list, which is a great place to ask questions, at: |
|---|
| 95 | |
|---|
| 96 | http://dojotoolkit.org/mailman/listinfo/dojo-interest |
|---|
| 97 | |
|---|
| 98 | The Dojo developers also tend to hang out in IRC and help people with Dojo |
|---|
| 99 | problems. You're most likely to find them at: |
|---|
| 100 | |
|---|
| 101 | irc.freenode.net #dojo |
|---|
| 102 | |
|---|
| 103 | Note that 3PM Wed PST in #dojo-meeting is reserved for a weekly meeting between |
|---|
| 104 | project developers, although anyone is welcome to participate. |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | Working From Source |
|---|
| 108 | ------------------- |
|---|
| 109 | |
|---|
| 110 | The core of Dojo is a powerful package system that allows developers to optimize |
|---|
| 111 | Dojo for deployment while using *exactly the same* application code in |
|---|
| 112 | development. Therefore, working from source is almost exactly like working from |
|---|
| 113 | a pre-built edition. Pre-built editions are significantly faster to load than |
|---|
| 114 | working from source, but are not as flexible when in development. |
|---|
| 115 | |
|---|
| 116 | There are multiple ways to get the source. Nightly snapshots of the Dojo source |
|---|
| 117 | repository are available at: |
|---|
| 118 | |
|---|
| 119 | http://archive.dojotoolkit.org/nightly.tgz |
|---|
| 120 | |
|---|
| 121 | Anonymous Subversion access is also available: |
|---|
| 122 | |
|---|
| 123 | %> svn co http://svn.dojotoolkit.org/dojo/trunk/ dojo |
|---|
| 124 | |
|---|
| 125 | Each of these sources will include some extra directories not included in the |
|---|
| 126 | pre-packaged editions, including command-line tests and build tools for |
|---|
| 127 | constructing your own packages. |
|---|
| 128 | |
|---|
| 129 | Running the command-line unit test suite requires Ant 1.6. If it is installed |
|---|
| 130 | and in your path, you can run the tests using: |
|---|
| 131 | |
|---|
| 132 | %> cd buildscripts |
|---|
| 133 | %> ant test |
|---|
| 134 | |
|---|
| 135 | The command-line test harness makes use of Rhino, a JavaScript interpreter |
|---|
| 136 | written in Java. Once you have a copy of Dojo's source tree, you have a copy of |
|---|
| 137 | Rhino. From the root directory, you can use Rhino interactively to load Dojo: |
|---|
| 138 | |
|---|
| 139 | %> java -jar buildscripts/lib/js.jar |
|---|
| 140 | Rhino 1.5 release 3 2002 01 27 |
|---|
| 141 | js> load("dojo.js"); |
|---|
| 142 | js> print(dojo); |
|---|
| 143 | [object Object] |
|---|
| 144 | js> quit(); |
|---|
| 145 | |
|---|
| 146 | This environment is wonderful for testing raw JavaScript functionality in, or |
|---|
| 147 | even for scripting your system. Since Rhino has full access to anything in |
|---|
| 148 | Java's classpath, the sky is the limit! |
|---|
| 149 | |
|---|
| 150 | Building Dojo |
|---|
| 151 | ------------- |
|---|
| 152 | |
|---|
| 153 | Dojo requires Ant 1.6.x in order to build correctly. While using Dojo from |
|---|
| 154 | source does *NOT* require that you make a build, speeding up your application by |
|---|
| 155 | constructing a custom profile build does. |
|---|
| 156 | |
|---|
| 157 | Once you have Ant and a source snapshot of Dojo, you can make your own profile |
|---|
| 158 | build ("edition") which includes only those modules your application uses by |
|---|
| 159 | customizing one of the files in: |
|---|
| 160 | |
|---|
| 161 | [dojo]/buildscripts/profiles/ |
|---|
| 162 | |
|---|
| 163 | These files are named *.profile.js and each one contains a list of modules to |
|---|
| 164 | include in a build. If we created a new profile called "test.profile.js", we |
|---|
| 165 | could then make a profile build using it by doing: |
|---|
| 166 | |
|---|
| 167 | %> cd buildscripts |
|---|
| 168 | %> ant -Dprofile=test -Ddocless=true release intern-strings |
|---|
| 169 | |
|---|
| 170 | If the build is successful, your newly minted and compressed profile build will |
|---|
| 171 | be placed in [dojo]/release/dojo/ |
|---|
| 172 | |
|---|
| 173 | ------------------------------------------------------------------------------- |
|---|
| 174 | Copyright (c) 2004-2006, The Dojo Foundation, All Rights Reserved |
|---|
| 175 | |
|---|
| 176 | vim:ts=4:et:tw=80:shiftwidth=4: |
|---|