src/http.js
function setup_listeners() {
    client.onerror            = make_error_handler('errored')
    client.onabort            = make_error_handler('forgotten')
    client.ontimeout          = make_error_handler('timeouted')
    client.onloadstart        = function(ev){ promise.fire('load:start', ev)    }
    client.onprogress         = function(ev){ promise.fire('load:progress', ev) }
    client.onloadend          = function(ev){ promise.fire('load:end', ev)      }
    client.onload             = function(ev){ promise.fire('load:success', ev)  }
    client.onreadystatechange = function(  ){
                                  var response, status, state
                                  state = client.readyState

                                  promise.fire('state:' + state_map[state])

                                  if (state == 4) {
                                    var binding_state = success.test(status)? 'ok'
                                                      : error.test(status)?   'failed'
                                                      : /* otherwise */       'any'

                                    response = client.responseText
                                    status   = normalise_status(client.status)
                                    active.splice(active.indexOf(promise), 1)
                                    promise.flush('status:' + status)
                                           .flush('status:' + status_type(status))

                                      status == 0?           raise('errored')
                                    : success.test(status)?  promise.bind(response, status)
                                    : error.test(status)?    promise.fail(response, status)
                                    : /* otherwise */        promise.done([response, status]) }}}
function setup_listeners() {
    client.onerror            = make_error_handler('errored')
    client.onabort            = make_error_handler('forgotten')
    client.ontimeout          = make_error_handler('timeouted')
    client.onloadstart        = function(ev){ promise.fire('load:start', ev)    }
    client.onprogress         = function(ev){ promise.fire('load:progress', ev) }
    client.onloadend          = function(ev){ promise.fire('load:end', ev)      }
    client.onload             = function(ev){ promise.fire('load:success', ev)  }
    client.onreadystatechange = function(  ){
                                  var response, status, state
                                  state = client.readyState

                                  promise.fire('state:' + state_map[state])

                                  if (state == 4) {
                                    var binding_state = success.test(status)? 'ok'
                                                      : error.test(status)?   'failed'
                                                      : /* otherwise */       'any'

                                    response = client.responseText
                                    status   = normalise_status(client.status)
                                    active.splice(active.indexOf(promise), 1)
                                    promise.flush('status:' + status)
                                           .flush('status:' + status_type(status))

                                      status == 0?           raise('errored')
                                    : success.test(status)?  promise.bind(response, status)
                                    : error.test(status)?    promise.fail(response, status)
                                    : /* otherwise */        promise.done([response, status]) }}}
function setup_listeners ( ) { client . onerror = make_error_handler ( 'errored' ) client . onabort = make_error_handler ( 'forgotten' ) client . ontimeout = make_error_handler ( 'timeouted' ) client . onloadstart = function ( ev ) { promise . fire ( 'load:start' , ev ) } client . onprogress = function ( ev ) { promise . fire ( 'load:progress' , ev ) } client . onloadend = function ( ev ) { promise . fire ( 'load:end' , ev ) } client . onload = function ( ev ) { promise . fire ( 'load:success' , ev ) } client . onreadystatechange = function ( ) { var response , status , state state = client . readyState promise . fire ( 'state:' + state_map [ state ] ) if ( state == 4 ) { var binding_state = success . test ( status ) ? 'ok' : error . test ( status ) ? 'failed' : /* otherwise */ 'any' response = client . responseText status = normalise_status ( client . status ) active . splice ( active . indexOf ( promise ) , 1 ) promise . flush ( 'status:' + status ) . flush ( 'status:' + status_type ( status ) ) status == 0 ? raise ( 'errored' ) : success . test ( status ) ? promise . bind ( response , status ) : error . test ( status ) ? promise . fail ( response , status ) : /* otherwise */ promise . done ( [ response , status ] ) } } }
Setups the event listeners for the HTTP request client setup-listeners :: () -> Undefined
Setups the event listeners for the HTTP request client setup - listeners :: () - > Undefined