edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Kevin Carhart <kevin@carhart.net>
To: edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] what is dispatchEvent and is it needed?
Date: Sat, 9 Dec 2017 22:39:16 -0800 (PST)	[thread overview]
Message-ID: <alpine.LRH.2.03.1712092206580.16897@carhart.net> (raw)
In-Reply-To: <20171105115426.eklhad@comcast.net>



Since we started talking about events, I felt like I needed to reacclimate 
myself with whether there is a point to some of these functions with Event 
in their name. 
Currently the first occurring runtime error in one of the sites we're 
testing on, xqsuperschool.org, involves dispatchEvent.  But what does it 
do?  I looked it up and found out.  The flavor of why dispatchEvent is 
used is a little like calling raise() in code.  It's like you're 
simulating something.  So the role for dispatchEvent would be if 
you want to call an event handler from elsewhere in the code.  If there is 
a button1 with a handler on click, the users might click the button and 
the handler code would run.  But if you want to trigger that code and you 
want to do it "the right way", you do it via interacting with that 
element.  So you call dispatchEvent(button,"click") and you have done just 
what your user would have.  An MDN page says "Such events are commonly called 
synthetic events, as opposed to the events fired by the browser itself."

It reminds me of OO.  You're reaching the handler code by addressing it 
through a published way of reaching it.  It reminds me of public and 
private members, and that type of flavor.

I suppose it would come up in the context of testing.  Also in the 
edbrowse code itself we have had situations where, I don't know, you're 
writing one DOM method, and you call another DOM method from within that, 
because it's already been tested and is as good a solution as revisiting 
the lower level stuff.

So based on this information, I think dispatchEvent is good solid 
functionality and once I get it together, I'll send some code.

Kevin


  parent reply	other threads:[~2017-12-10  6:37 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 15:48 [Edbrowse-dev] Problem installing git version on debian sid Chuck Hallenbeck
2017-12-04 18:19 ` Geoff McLane
2017-12-04 19:48   ` Chuck Hallenbeck
2017-12-04 20:23     ` Geoff McLane
2017-12-04 23:42       ` Kevin Carhart
2017-12-05  0:47         ` Chuck Hallenbeck
2017-12-05 14:58           ` Chris Brannon
2017-12-05 16:36             ` Chuck Hallenbeck
2017-12-05 16:54               ` Karl Dahlke
2017-12-05 17:26                 ` Chuck Hallenbeck
2017-12-05 18:57                   ` Geoff McLane
2017-12-05 20:03                     ` Chuck Hallenbeck
2017-12-10  6:39                 ` Kevin Carhart [this message]
2017-12-10  6:48                   ` [Edbrowse-dev] what is dispatchEvent and is it needed? Karl Dahlke
2017-12-10  8:28                     ` Kevin Carhart
2017-12-05  1:01         ` [Edbrowse-dev] Problem installing git version on debian sid Chuck Hallenbeck
2017-12-04 20:12   ` Chuck Hallenbeck
2017-12-04 20:36     ` Karl Dahlke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.03.1712092206580.16897@carhart.net \
    --to=kevin@carhart.net \
    --cc=edbrowse-dev@lists.the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).