Permalink
Browse files

Uses JS highlighting for the example code.

  • Loading branch information...
1 parent e1e4f52 commit da1abd87591156124f478cf400a6a993cb9c37f4 @robotlolita robotlolita committed Apr 19, 2012
Showing with 31 additions and 31 deletions.
  1. +31 −31 README.md
View
@@ -5,38 +5,38 @@ Iris is a library for handling HTTP (through XMLHttpRequest) and JSONP requests
in a more high-level way. It uses promises to allow for more declarative and
flexible handling of the responses from either side.
+```javascript
+// HTTP example
+var http = require('iris').http
+
+http.get('/user/profile')
+ .timeout(10) // in seconds
+ .ok(function(data){
+ $('#user').html(data)
+ })
+ .timeouted(function(){
+ dialog.error('The operation timed out.')
+ })
+ .failed(function() {
+ dialog.error('Ooops, something went wrong.')
+ })
+
- // HTTP example
- var http = require('iris').http
-
- http.get('/user/profile')
- .timeout(10) // in seconds
- .ok(function(data){
- $('#user').html(data)
- })
- .timeouted(function(){
- dialog.error('The operation timed out.')
- })
- .failed(function() {
- dialog.error('Ooops, something went wrong.')
- })
-
-
- // JSONP example
- var jsonp = require('iris').jsonp
-
- jsonp.get('/user/posts')
- .timeout(10)
- .ok(function(data) {
- $('#post-count').text(data.posts.length + ' posts.')
- })
- .timeouted(function() {
- dialog.error('The operation timed out.')
- })
- .failed(function() {
- dialog.error('Ooops, something went wrong.')
- })
-
+// JSONP example
+var jsonp = require('iris').jsonp
+
+jsonp.get('/user/posts')
+ .timeout(10)
+ .ok(function(data) {
+ $('#post-count').text(data.posts.length + ' posts.')
+ })
+ .timeouted(function() {
+ dialog.error('The operation timed out.')
+ })
+ .failed(function() {
+ dialog.error('Ooops, something went wrong.')
+ })
+```
Requirements and Supported Platforms
------------------------------------

0 comments on commit da1abd8

Please sign in to comment.