Skip to content

Commit 33b7a60

Browse files
githubshrekKrinkle
authored andcommitted
Events: Make the example runnable
The proposed changes, together with the style sheet suggestion proposed in the previous proposed change (and shown below), means that the example moves from being abstract, and students can directly copy/paste the example and see it work. <style> .on { background-color: yellow; } .off { background-color: black; color: white; } </style> Closes #535.
1 parent dadb33b commit 33b7a60

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

page/events/introduction-to-custom-events.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ Let's make our example a little more interesting. We'll add another room to our
6565

6666
```
6767
<div class="room" id="kitchen">
68-
<div class="lightbulb on"></div>
69-
<div class="switch"></div>
70-
<div class="switch"></div>
71-
<div class="clapper"></div>
68+
<div class="lightbulb on">Kitchen light</div>
69+
<div class="switch">Kitchen switch 1</div>
70+
<div class="switch">Kitchen switch 1</div>
71+
<div class="clapper">Kitchen clapper switch</div>
7272
</div>
7373
<div class="room" id="bedroom">
74-
<div class="lightbulb on"></div>
75-
<div class="switch"></div>
76-
<div class="switch"></div>
77-
<div class="clapper"></div>
74+
<div class="lightbulb on">Bedroom light</div>
75+
<div class="switch">Bedroom switch 1</div>
76+
<div class="switch">Bedroom switch 2</div>
77+
<div class="clapper">Bedroom clapper switch</div>
7878
</div>
79-
<div id="master_switch"></div>
79+
<div id="master_switch">Master switch</div>
8080
```
8181

8282
If there are any lights on in the house, we want the master switch to turn all the lights off; otherwise, we want it to turn all lights on. To accomplish this, we'll add two more custom events to the lightbulbs: `light:on` and `light:off`. We'll make use of them in the `light:toggle` custom event, and use some logic to decide which one the master switch should trigger:

0 commit comments

Comments
 (0)