Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README.textile
on.html
on.js

README.textile

dojo.on()

A simple Dojo plugin to enable an easier to read format for dojo.connect.


  // before
  var handle = dojo.connect(dojo.byId("someNode"), "click", function(evt) {
    evt.preventDefault();
    dojo.style(evt.currentTarget, "color", "red");
  });
  
  dojo.disconnect(handle);
  
  // with dojo.on()
  
  dojo.on("someNode", "click")
    .prevent()
    .then(function(evt){
      dojo.style(evt.currentTarget, "color", "red");
    })
    .disconnect();
    
  // with dojo.eat() and some friends
  // dojo.eat() is just like dojo.on().prevent()
  
  dojo.eat("someNode", "click")
      .then(function(evt) { 
        dojo.style(evt.currentTarget, "color", "red"); 
      })
      .disconnect();
               

Something went wrong with that request. Please try again.