Widget.addDirectEventListener

Events use a Javascript-esque model. See more details on the Event page.

addEventListener returns an opaque handle that you can later pass to removeEventListener.

addDirectEventListener just inserts a check if(e.target !is this) return; meaning it opts out of participating in handler delegation.

Use scope on your handlers when you can. While it currently does nothing, this will future-proof your code against future optimizations I want to do. Instead of copying whole event objects out if you do need to store them, just copy the properties you need.
  1. EventListener addDirectEventListener(string event, void delegate() handler, bool useCapture)
    class Widget
    addDirectEventListener
    (
    string event
    ,
    void delegate
    ()
    handler
    ,
    bool useCapture = false
    )
  2. EventListener addDirectEventListener(string event, void delegate(Event) handler, bool useCapture)
  3. EventListener addDirectEventListener(Handler handler, bool useCapture)

Meta