Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Latest commit

 

History

History
15 lines (13 loc) · 409 Bytes

Events.md

File metadata and controls

15 lines (13 loc) · 409 Bytes

Events

The Polis embed code and <iframe/> are configured to emit a "vote" event each time a participant votes. You can subscribe to those events on the page that instantiates the <iframe/> like this:

 window.addEventListener("message", function(event) {
  var data = event.data||{};
  if (!event.origin.match(/pol.is$/)) {
    return;
  }
  if (data.name === "vote") {
    alert("vote!");
  }