[webkit-dev] Add custom event into Webkit

Darin Adler darin at apple.com
Thu Apr 9 08:45:11 PDT 2009

On Apr 9, 2009, at 2:40 AM, Tony Louaze wrote:

> I want to add a custom event into Webkit without modify and compile  
> Webkit.

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.

In JavaScript it would be something like this:

     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.

WebKit DOM bindings for JavaScript and for Objective-C on Mac OS X are  
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

More information about the webkit-dev mailing list