Skip to content

Instantly share code, notes, and snippets.

@apalepu23
Last active November 9, 2018 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apalepu23/15099df1ac25082b4a824342e5ea26b2 to your computer and use it in GitHub Desktop.
Save apalepu23/15099df1ac25082b4a824342e5ea26b2 to your computer and use it in GitHub Desktop.
Callback
// onChange listener to trigger enigma task when poll has ended
async handleTimerEnd(pollID) {
const { polls } = this.state;
await this.enigmaTask(pollID);
const pollStatusUpdateEvent = this.props.voting.PollStatusUpdate();
pollStatusUpdateEvent.watch(async (error, result) => {
let pollStatus = await this.props.voting.getPollStatus.call(pollID, {
from: this.props.enigmaSetup.accounts[this.props.curAccount],
gas: GAS
});
polls[pollID].status = pollStatus;
this.setState({ polls });
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment