April 2018
Beginner to intermediate
406 pages
9h 33m
English
We'll want to start off by modifying our join function to turn off the event handlers for the buttons with the vote-button-manual CSS class attached to them (remember I said we'd be dealing with those again later). We'll also have it output something to the developer logs so that we can verify things are working before we start implementing the next pieces:
// Next, join the topic on the channel! channel .join() .receive('ok', res => { document.querySelectorAll('.vote-button-manual').forEach(el => { el.addEventListener('click', event => { event.preventDefault(); console.log('Do something special!'); }); }); console.log('Joined channel:', res); }) .receive('error', res => console.log('Failed to join channel:', ...