| View previous topic :: View next topic |
| Author |
Message |
Kopilman
Joined: 25 May 2006 Posts: 162
|
| Hi, anyone know how to make my custom object work with addEventListener? |
| |
|
|
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| I didn't think you could call events on non DOM objects |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
| Oh. |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| AddEventListener is a method of EventTarget |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
| Yeah I figured that out. |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| "The EventTarget interface is implemented by all Nodes in an implementation which supports the DOM Event Model" |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
| I'm kind of new to OO js. Can I inherit EventTarget? |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| No |
| |
|
|
Jackil
Joined: 24 May 2006 Posts: 97
|
| I don't think you can make a new kind of DOM element, can you? |
| |
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
Okay. Well there are five hundred other ways to do this, I was just bugged that it didn't work that way when I tried it.
I'm curious about the EventTarget thing. How would I go about applying that interface to my object? In the prototype? |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
Mupolan: I can't get it to do anything useful
The thing I was doing, that is
You can implement the interface yourself
You just have to provide those methods |
| |
|
|
|
|
Kopilman
Joined: 25 May 2006 Posts: 162
|
Right.
Thanks for the help! |
| |
|
|
|