Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ghondar/react-native-coinhive-miner
CoinHive cryptocurrency miner for react-native
https://github.com/ghondar/react-native-coinhive-miner
Last synced: 3 months ago
JSON representation
CoinHive cryptocurrency miner for react-native
- Host: GitHub
- URL: https://github.com/ghondar/react-native-coinhive-miner
- Owner: ghondar
- Created: 2018-01-05T22:49:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-27T14:04:15.000Z (almost 7 years ago)
- Last Synced: 2024-10-01T06:01:17.951Z (3 months ago)
- Language: HTML
- Size: 28.3 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-coinhive-miner
#### Install via npm
`npm i react-native-coinhive-miner --save`
#### Usage
```Javascript
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View,
TouchableHighlight
} from 'react-native';import CoinHiveClient from 'react-native-coinhive-miner'
export default class App extends Component<{}> {
state = {
speed: 100
}onPress() {
this.setState({
speed: 90
})
}render() {
return (
this.onPress()}>
speed down
{this.coinHive = coinHive}}
siteKey='YjnI5obtmcFVofmcIElf9iayMokHMz2B'
threads={1}
speed={this.state.speed}
onSpeed={(speed) => { console.log(speed) }}
onThreads={(threads) => { console.log(threads) }}
...
/>
);
}
}
```## API
### Props
* `siteKey` - String
* `threads` - Number
* `speed` - Number (10 - 100)
* `devSpeed` - Number (10 - 100)### Ref Function
* `stopNow` - Inmediate stop
* `stop()` - stop mining
* `addThread()` - add 1 thread
* `removeThread()` - remove 1 thread
* `speedUp()` - add 10% to speed
* `speedDown()` - remove 10% to speed### Events
* `onStats` - Event Function
* `onStop` - Event Function
* `onRunning`- Event Function
* `onStart` - Event Function
* `onSpeed` - Event Function
* `onThreads`- Event Function
* `onInit` - Event Function
* `onStart` - Event Function
* `onStop` - Event Function#### LICENSE
MIT