minor fixes
This commit is contained in:
parent
83b7de0b79
commit
b0a86b9010
1 changed files with 2 additions and 1 deletions
|
@ -373,7 +373,7 @@ For instance:
|
||||||
|
|
||||||
As we can see, when `addEventListener` receives an object as the handler, it calls `obj.handleEvent(event)` in case of an event.
|
As we can see, when `addEventListener` receives an object as the handler, it calls `obj.handleEvent(event)` in case of an event.
|
||||||
|
|
||||||
We could also use a class (although we still have to instantiate it as an object):
|
We could also use objects of a custom class, like this:
|
||||||
|
|
||||||
|
|
||||||
```html run
|
```html run
|
||||||
|
@ -395,6 +395,7 @@ We could also use a class (although we still have to instantiate it as an object
|
||||||
|
|
||||||
*!*
|
*!*
|
||||||
let menu = new Menu();
|
let menu = new Menu();
|
||||||
|
|
||||||
elem.addEventListener('mousedown', menu);
|
elem.addEventListener('mousedown', menu);
|
||||||
elem.addEventListener('mouseup', menu);
|
elem.addEventListener('mouseup', menu);
|
||||||
*/!*
|
*/!*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue