react-authedmine
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "react-authedmine", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Authedmine from CoinHive.com", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -7,2 +7,4 @@ import React, { Component } from 'react'; | ||
static propTypes = { | ||
run: PropTypes.bool.isRequired, | ||
siteKey: PropTypes.string, | ||
@@ -47,2 +49,16 @@ userName: PropTypes.string, | ||
} | ||
if (this.state.loaded && this.state.run) { | ||
if (this.state.userName !== prevProps.userName) { | ||
const isRunning = this.miner.isRunning; | ||
if (prevProps !== this.props) { | ||
this.initMiner(); | ||
} | ||
if (isRunning) { | ||
this.start(); | ||
} | ||
} | ||
} | ||
} | ||
@@ -53,3 +69,3 @@ | ||
if (this.state.loaded) { | ||
if (this.state.loaded && this.state.run) { | ||
if (this.state.userName !== prevProps.userName) { | ||
@@ -56,0 +72,0 @@ const isRunning = this.miner.isRunning; |
9518
222