<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,11 +12,11 @@ h3. Parameters
 
 | param | expected type | description |
 | url | String | The url from which you're fetching data |
-| callback | Function | A function that will be called when the data is received |
-| options | Optional Hash | Described below |
+| callback | Function or Hash | A function that will be called when the data is received, or a hash described below |
 
 Options Hash:
 | key | expected type | description |
+| onSuccess | Function | A function to be called when the data is received |
 | onError | Function | A function to be called if there is an error fetching the data |
 
 h3. Example
@@ -27,6 +27,10 @@ var callback = function (data) {
     alert(data);
 };
 CentralDispatch.requestData('http://trottercashion.com/examples/cdData.js', callback)
+
+var errorCallback = function (msg, url, line) {
+    alert(&quot;error: &quot; + msg);
+}
 &lt;/code&gt;
 &lt;/pre&gt;
 </diff>
      <filename>README.textile</filename>
    </modified>
    <modified>
      <diff>@@ -4,41 +4,48 @@ var CentralDispatch = function () {
         addCallback, findCallbacks, runCallbacks,
         makeRequest, RequestMap;
 
-    makeRequest = function (url, callback, options) {
-        var self = {}, tag, executed = false;
-        options = options || {};
-
-        self.callback = function (data) { 
-            callback(data); 
-            if (self.tag &amp;&amp; !executed) {
-                document.body.removeChild(self.tag); 
-                self.tag = null; 
+    makeRequest = function (url, callback) {
+        var self = {}, element, executed = false,
+            onSuccess, onError;
+
+        if (typeof(callback) === 'function') {
+            onSuccess = callback;
+        } else {
+            onSuccess = callback.onSuccess;
+            onError = callback.onError;
+        }
+
+        self.success = function (data) { 
+            onSuccess(data); 
+            if (self.element &amp;&amp; !executed) {
+                document.body.removeChild(self.element); 
+                self.element = null; 
             }
             executed = true;
         };
 
         self.url = url;
         
-        self.tag = function () {
-            var tag;
-            tag = document.createElement('script');
-            tag.src = url;
-            tag.onerror = function () { 
-                if (options.onError) {
-                    options.onError();
+        self.element = function () {
+            var element;
+            element = document.createElement('script');
+            element.src = url;
+            element.onerror = function (msg, url, line) { 
+                if (onError) {
+                    onError(msg, url, line);
                 }
-                if (tag &amp;&amp; !executed) {
-                    document.body.removeChild(tag);
+                if (element &amp;&amp; !executed) {
+                    document.body.removeChild(element);
                     RequestMap.remove(self);
-                    tag = null;
+                    element = null;
                 }
                 executed = true;
             };
-            return tag;
+            return element;
         }();
 
         self.addToDom = function () {
-            document.body.appendChild(self.tag);
+            document.body.appendChild(self.element);
         };
 
         RequestMap.add(self);
@@ -81,7 +88,7 @@ var CentralDispatch = function () {
             while (current) {
                 // TODO: Should clone data so that functions don't spoil the fun for
                 // others.
-                current.callback(data); 
+                current.success(data); 
                 current = matches.pop();
             }
         };
@@ -104,15 +111,17 @@ var CentralDispatch = function () {
         return klass;
     }();
 
-    klass.requestData = function (url, callback, options) {
-        var request = makeRequest(url, callback, options);
+    klass.requestData = function (url, callback) {
+        var request = makeRequest(url, callback);
         request.addToDom();
-        return request.tag;
+        return request;
     };
 
     klass.receiveData = function (version, url, data) {
         RequestMap.runAllFor(url, data);
     };
 
+    klass.timeout = 60000; // 60 seconds
+
     return klass;
 }();</diff>
      <filename>js/lib/central_dispatch.js</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@ Screw.Unit(function () {
                     storedData = data;
                 };
                 requestedUrl = 'http://test.host/test.js';
-                element = CentralDispatch.requestData(requestedUrl, callback);
+                element = CentralDispatch.requestData(requestedUrl, callback).element;
             });
 
             it('should callback when receiving data for http://test.host/test.js', function () {
@@ -116,7 +116,7 @@ Screw.Unit(function () {
                     storedData = 'error';
                 };
                 requestedUrl = 'http://test.host/test.js';
-                element = CentralDispatch.requestData(requestedUrl, callback, { onError: errorCallback });
+                element = CentralDispatch.requestData(requestedUrl, { onSuccess: callback, onError: errorCallback }).element;
             });
 
             it('should call the error callback', function () {
@@ -143,8 +143,18 @@ Screw.Unit(function () {
         });
 
         describe('registered to receive a timeout callback', function () {
+            var timeoutCallback, url, storedData, successCallback, element;
 
             before(function () {
+                storedData = null;
+                successCallback = function (data) {
+                    storedData = data;
+                };
+                timeoutCallback = function () {
+                    storedData = 'timeout';
+                };
+                url = 'http://test.host/test.js';
+                element = CentralDispatch.requestData(url, { onSuccess: successCallback, onTimeout: timeoutCallback }).element;
             });
         });
     });</diff>
      <filename>js/test/bundle/central_dispatch_spec.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>af42762bb618a2fd6c832563ed8615f6b28f9ee1</id>
    </parent>
  </parents>
  <author>
    <name>Trotter Cashion</name>
    <email>cashion@gmail.com</email>
  </author>
  <url>http://github.com/trotter/central-dispatch/commit/60e60cc9db3ca555d81db7d10e75643ab687bc52</url>
  <id>60e60cc9db3ca555d81db7d10e75643ab687bc52</id>
  <committed-date>2009-04-20T07:31:38-07:00</committed-date>
  <authored-date>2009-04-20T07:31:38-07:00</authored-date>
  <message>Return request and pass along all error information</message>
  <tree>5407ac25e1239d03caad5a9c9a9359a7300379d6</tree>
  <committer>
    <name>Trotter Cashion</name>
    <email>cashion@gmail.com</email>
  </committer>
</commit>
