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