Intercooler JS API

Intercooler has a few different extension points. You can call a few direct methods on the global Intercooler object, and you can also listen for intercooler related events.


Method Description
Intercooler.defineTransition(transition) Lets you add a new transtion, which should implement the newContent, remove, hide and show methods:
  Intercooler.defineTransition('fadeSlow', {
      newContent : function(parent, newContent, isReverse, after){
        parent.fadeOut('slow', function(){
      remove : function(elt) {
        elt.fadeOut('slow', function(){ elt.remove(); })
      show : function(elt) {
      hide : function(elt) {

Intercooler.defaultTransition(name) Lets you set the default transition to use
Intercooler.refresh(eltOrPath) If the argument is an element, it will issue a new AJAX request. If it is a string path, it will issue a request for all dependent elements.


Intercooler fires the following events on elements:

Event Description
log.ic(evt, msg, level, elt) Event fired when log messages occur internally in intercooler (can be used to debug specific DOM elements.)
beforeHeaders.ic(evt, elt, xhr) Triggered before intercooler headers are processed.
afterHeaders.ic(evt, elt, xhr) Triggered after intercooler headers are processed.
beforeSend.ic(evt, elt, data) Triggered before sending an intercooler AJAX request to the server. The second argument to the event is the data hash, and can be added or removed from to change the values sent to the server.
success.ic(evt, elt, data, textStatus, xhr) Triggered after a successful intercooler request is received
error.ic(evt, elt, req, status, str) Triggered after an error occurs during an intercooler request
complete.ic(evt, elt, data) Triggered after an intercooler request completes, regardless of status
onPoll.ic(evt, elt) Triggered before a poll request is dispatched


Here is some code that uses the BlockUI library to block the UI when an intercooler request is in flight:

          $('.btn').on('beforeSend.ic', function(){
          }).on('complete.ic', function(){