Skip to content

Commit

Permalink
Uses JS highlighting for the example code.
Browse files Browse the repository at this point in the history
  • Loading branch information
robotlolita committed Apr 19, 2012
1 parent e1e4f52 commit da1abd8
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------------------------
Expand Down

0 comments on commit da1abd8

Please sign in to comment.