import React from 'react'; import { MenuBar } from './menubar'; import { NgIf, Icon } from '../../components/'; export class FileDownloader extends React.Component{ constructor(props){ super(props) this.state = {loading: false, id: null}; } onClick(){ document.cookie = "download=yes; path=/; max-age=120;"; this.setState({ loading: true, id: window.setInterval(function(){ if(/download=yes/.test(document.cookie) === false){ this.setState({loading: false}) window.clearInterval(this.state.id); } }.bind(this), 80) }); } componentWillUnmount(){ window.clearInterval(this.state.id) } render(){ return (
DOWNLOAD
); } }