Login Register

Event System

dojo.event

Most of the functionality from the dojo.event package has moved to dojo base so it is always available. This page addresses the functionality formerly found under dojo.event.browser, dojo.event.connect and dojo.event.topic.

dojo.event.browser

What was dojo.event.browser is now available under dojo.event, and is part of dojo base. The dojo._base.event package (./dojo/_base/event.js) concerns just the normalization of DOM events and browser event handling. For example:

  • dojo.event.browser.keys becomes dojo.keys
  • dojo.event.browser.stopEvent becomes dojo.stopEvent
  • dojo.event.browser.fixEvent becomes dojo.fixEvent

dojo.event.connect

.. has moved to dojo.connect, and is part of dojo base

  • The dojo._base.connect package (./dojo/_base/connect.js) deals with connecting events to functions (like 0.4, the events may be other functions/methods).
  • dojo.connect now returns a connection handle (an array of obj, event, handler, listener)
  • Variable calling signatures to connect are still supported (all? confirm)
  • Params that can be null may still be omitted.
  • Connect after/before/around keywords are not handled by dojo.connect
  • kwConnect variant is no longer available

dojo.event.disconnect

has moved to dojo.disconnect

  • expects a connection handle array - as returned by dojo.connect

Topics

dojo.event.topic has moved to dojo base.

dojo.event.topic.subscribe/unsubscribe

  • now called as dojo.subscribe, dojo.unsubscribe
  • subscribe now returns a handle which is needed to unsubscribe this listener.
  • like disconnect, unsubscribe now expects a single connection handle array argument (as returned by subscribe)

dojo.event.topic.publish

  • dojo.event.topic.publish becomes dojo.publish
  • 2nd argument is now an arguments array that will be supplied to all subscribers

Advice

The after/before/around advice features have been removed with no replacement.
These features may be reinstated in the future as a dojox module.

In the meantime you can hack it yourself. For example, to add log statements before and after a function is called (ie, around advice):


var originalFunc = dijit.ContentPane.prototype.setContent;
dijit.ContentPane.prototype.setContent = function(){
  console.log(...);
  originalFunc.apply(this, arguments);
  console.log(...);
}

Where has kwConnect moved to?

Maybe it was removed, in this case just use the dojo.connect, right?

"KEY_" removed, e.g. keys.KEY_SPACE to keys.SPACE

Note that the constant names have all had the string "KEY_" removed from their start, so you may need to go through your code and remove this string where you've tested for a keystroke.

Just curious

Why was were the advice features removed? Preformance reasons? Regardless, they have often proved useful.

Event Handling query

Hello,

I am using dojo for event handling. I have one html in which there are 3 divs. one for header, middle for dynamic loading page and third for footer. when fill the middle div for second page i am intialing event handlers of second dynamic page but it is taking event handlers of first page and it is not reconizing new page buttons events and invoking the event handler functions of first page. Can anyone please give me solution. I am waiting despartely for this.
Regards,

PARAG

For support, post in the Forums....

For support, post in the Forums....

-Karl