Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: sdk/lib/html/templates/html/impl/impl_XMLHttpRequest.darttemplate

Issue 11471005: Add documentation for HttpRequest. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/html/templates/html/impl/impl_XMLHttpRequest.darttemplate
===================================================================
--- sdk/lib/html/templates/html/impl/impl_XMLHttpRequest.darttemplate (revision 15801)
+++ sdk/lib/html/templates/html/impl/impl_XMLHttpRequest.darttemplate (working copy)
@@ -4,11 +4,34 @@
part of html;
-/// @domName $DOMNAME
+/// HttpRequest is a utility for retrieving data from a URL.
+///
+/// HttpRequest can be used to obtain data from http, ftp, as well as file
+/// protocols.
+///
+/// For example, suppose we're developing this Dart documentation page, and we
+/// wish to retrieve the html of the top level page and print it out.
+/// The easiest way to do that would be:
+///
+/// var httpRequest = HttpRequest.get('http://api.dartlang.org', (request) => print(request.responseText));
+///
+/// It is important to note that with the default behavior of this class, your
+/// code making the request should be served from the same origin (domain name,
+/// port, and application layer protocol) as the url you are trying to access
+/// with HttpRequest. However, there are ways to
+/// [get around this restriction](http://www.dartlang.org/articles/json-web-service/#note-on-jsonp).
+///
+/// See also:
+/// [Dart article on using HttpRequests](http://www.dartlang.org/articles/json-web-service/#getting-data),
+/// [JS XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest),
+/// and [Using XMLHttpRequest](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest)
+/// @domName $DOMNAME; @docsEditable true
class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
+ /// @docsEditable true
factory $CLASSNAME.get(String url, onComplete($CLASSNAME request)) =>
_$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_get(url, onComplete);
+ /// @docsEditable true
factory $CLASSNAME.getWithCredentials(String url,
onComplete($CLASSNAME request)) =>
_$(CLASSNAME)FactoryProvider.create$(CLASSNAME)_getWithCredentials(url,

Powered by Google App Engine
This is Rietveld 408576698