var Notify, NotifyWrap, createNotifies; export default window.NotifyWrap = NotifyWrap = class NotifyWrap extends React.Component { constructor(props) { super(props); this.state = { index: 0 }; this.notifies = {}; } create(data) { var index; ({ index } = this.state); index++; this.notifies[index] = /*#__PURE__*/React.createElement(Notify, { key: index, data: data }); return this.setState({ index }); } render() { var arr, i; arr = []; for (i in this.notifies) { arr.push(this.notifies[i]); } return /*#__PURE__*/React.createElement("div", null, arr); } }; Notify = class Notify extends React.Component { constructor(props) { super(props); this.state = this.prepare(props.data); this.close = this.close.bind(this); } prepare(data) { var ref, ref1, ref2, s; return s = { opened: false, removed: false, timeout: (ref = data.timeout) != null ? ref : 3000, text: (ref1 = data.text) != null ? ref1 : '', color: (ref2 = data.color) != null ? ref2 : '' }; } close() { var t; t = this; t.setState({ opened: false }); return setTimeout(function () { t.setState({ removed: true }); return t = null; }, 150); } componentDidMount() { var t; t = this; setTimeout(function () { return t.setState({ opened: true }); }, 10); return setTimeout(this.close, this.state.timeout); } render() { var color, opened, removed, text; ({ opened, removed, text, color } = this.state); if (removed) { return null; } return /*#__PURE__*/React.createElement("div", { className: "notify " + color + (opened ? " opened" : ""), onClick: this.close }, text); } }; createNotifies = function () { var div; div = document.createElement('div'); div.id = 'notifies'; document.body.appendChild(div); return ReactDOM.render( /*#__PURE__*/React.createElement(NotifyWrap, { ref: function (i) { return window.Notify = i; } }), div); }; document.addEventListener('DOMContentLoaded', createNotifies); //# sourceMappingURL=notify.js.map