Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#12986 closed enhancement (fixed)

on() method

Reported by: bill Owned by: bill
Priority: high Milestone: 1.7
Component: Dijit Version: 1.6.1
Keywords: Cc:
Blocked By: Blocking:

Description

Support on() method for connecting to widget events:

myWidget.on("click", func)

(This is coming for free with a cleanup I'm doing, but filing a ticket for reference.)

Change History (6)

comment:1 Changed 9 years ago by bill

Resolution: fixed
Status: newclosed

(In [25033]) Refactor widget deferred connect code to leverage new event modules. As a fringe benefit this adds an on() method to _WidgetBase, so code can do myWidget.on("click", func) instead of dojo.connect(myWidget, "onClick", ...).

Refs #5417, #12451. Fixes #12986 !strict.

comment:2 Changed 9 years ago by bill

(In [25051]) improve regex, and change where dojo.hitch() is call (on() itself shouldn't set any scope for the callback), refs #12986 !strict

comment:3 Changed 9 years ago by bill

(In [25056]) Revise "deferred connect" refactor to use stub functions again (like in 1.6), so that parser knows that onMouseMove etc. is a function. Refs #12986, fixes #12999 !strict.

comment:4 Changed 9 years ago by bill

(In [25057]) Remove duplicate API documentation. _Widget.on() "inherits" the documentation from _WidgetBase.on(). Refs #12986 !strict.

comment:5 Changed 8 years ago by bill

In [26317]:

No need to support on("onclick", ...) etc., just on("click", ...). Refs #12986 !strict.

comment:6 Changed 8 years ago by bill

In [26348]:

Make on() case insensitive, since users will often expect widget.on("mousemove", fn) to work (similar to on(node, "mousemove", fl)), rather than on("mouseMove") with capital letters. Also allow on() calls to attach to methods without "on" prefix, ex: widget.on("resize", ...). Refs #12986 !strict.

Note: See TracTickets for help on using tickets.