Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

Building our dummy functionality

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:', ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content