[webkit-dev] Add custom event into Webkit
ross.lillie at motorola.com
Thu Apr 9 09:11:33 PDT 2009
Thanks for the reply. Yes, this is starting to make sense, please excuse,
I'd figured out that I can create arbitrarily named events via the DOMEvent
class (in my external code), however, as you mentioned, the problem is that
I need to attach special data.
In a nutshell, I want to expose an external device model (C or C++) to
the JSContext allowing me to expose my external code internally as a
The next piece of the puzzle, however, is dispatching events generated by my
require special data to be attached. From my admittedly limited
understanding of WebKit internals, it would appear that I can't do this
without bypassing the public interfaces.
Finally, if I want my custom event targets to be an attribute on a DOM node,
I would think that I would also need to create a custom attribute node that
implements the EventTarget interface, and register this node in some manner
within WebKit's core - but I haven't dug into this far enough yet. While
this isn't strictly necessary, it provide nice syntactic sugar when
developing an interface that works with your external device model.
Obviously, I'd like to avoid bypassing public webkit interfaces. I just
don't know if I can cleanly do what I need to with the current APIs for my
I hope I'm not complete out in the weeds in my current understanding. Your
comments have been helpful. Hopefully, this explanation makes more sense.
Thanks loads for the feedback.
On 4/9/09 10:45 AM, "Darin Adler" <darin at apple.com> wrote:
> On Apr 9, 2009, at 2:40 AM, Tony Louaze wrote:
>> I want to add a custom event into Webkit without modify and compile
> It all depends what you mean by a custom event. If you want to send an
> event with a special name but no special data attached, you can do
> this easily with standard DOM API.
> var event = document.createEvent("Events");
> event.initEvent("specialName", false, false);
>> On which object should I make the "addEventListener" : a custom JS
>> object or an existing DOM object (which one ?) ?
> You can send an event to any event target object, which can be any DOM
> node or other type of object, and the listener would need to be
> attached to that object, the one you send the event to. Your question
> isn¹t specific enough.
>> For now, I'm just interracting with JS context by using the
>> Webkit.dll API.
> mostly complete; the ones done with COM on Windows are enough for
> Safari but are incomplete, and are likely missing some things you¹d
> need to deal with custom events.
> -- Darin
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
More information about the webkit-dev