Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emit id on close #47

Merged
merged 1 commit into from
Feb 12, 2018
Merged

Conversation

z-vr
Copy link
Contributor

@z-vr z-vr commented Feb 9, 2018

This is useful because SHOW emits an id, and so should CLOSE -- that way it's possible to know all open and closed popups. e.g.,

constructor(props) {
    super(props);
    this.state = {
      openPopups: [],
    };
    Popup.addShowListener((pid) => {
      if (!this.state.openPopups.includes(pid)) { // this is because SHOW is also emitted when a popup is opened from the queue. 
        this.setState(({ openPopups }) => ({
          openPopups: [...openPopups, pid],
        }));
      }
    });
    Popup.addCloseListener((pid) => {
      this.setState(({ openPopups }) => ({
        openPopups: openPopups.filter(id => id !== pid),
      }));
    });
  }

@tbleckert tbleckert added this to the v1.0.0 milestone Feb 12, 2018
@tbleckert
Copy link
Contributor

Ah thanks for this, close should obviously emit and ID as well. I'll merge it in right away. I'm making it a part of the v1.0.0 milestone. So it will go out together with some other stuff on February 15th.

@tbleckert tbleckert merged commit 7086177 into minutemailer:master Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants