mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Add Types for react-coinhive (#27010)
* Add Types for react-coinhive * Update TypeScript version (#27010)
This commit is contained in:
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for react-coinhive 1.0
|
||||
// Project: https://github.com/dragma/react-coinhive
|
||||
// Definitions by: sktbcbbs <https://github.com/sktbcbbs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export interface CoinHiveProps {
|
||||
autoThreads?: boolean;
|
||||
|
||||
run?: boolean;
|
||||
|
||||
siteKey: string;
|
||||
|
||||
src?: string;
|
||||
|
||||
threads?: number;
|
||||
|
||||
throttle?: number;
|
||||
|
||||
userName?: string;
|
||||
|
||||
onInit?: (callback: any) => void;
|
||||
|
||||
onStart?: (callback: any) => void;
|
||||
|
||||
onStop?: (callback: any) => void;
|
||||
}
|
||||
|
||||
export default class CoinHive extends React.Component<CoinHiveProps, any> {
|
||||
static getMinerData(miner: any): any;
|
||||
|
||||
static src: {
|
||||
authedmine: string;
|
||||
coinhive: string;
|
||||
};
|
||||
|
||||
onInit(miner: any): any;
|
||||
|
||||
onStart(miner: any): any;
|
||||
|
||||
onStop(miner: any): any;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import * as React from "react";
|
||||
import CoinHive, { CoinHiveProps } from "react-coinhive";
|
||||
|
||||
export class CoinHiveTest extends React.Component {
|
||||
render() {
|
||||
const props: CoinHiveProps = {
|
||||
userName: "Maya",
|
||||
siteKey: "tbzWvRTBa3VAKefxUmDZx6P6wjCSHXz0",
|
||||
autoThreads: false,
|
||||
threads: 2,
|
||||
src: CoinHive.src.authedmine,
|
||||
onInit: () => {},
|
||||
onStart: () => {},
|
||||
onStop: () => {},
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<CoinHive {...props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-coinhive-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user