mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-04-05 05:04:26 +00:00
add types for react-mic (#40845)
This commit is contained in:
committed by
Daniel Rosenwasser
parent
a4aafc64dd
commit
d3197272fc
35
types/react-mic/index.d.ts
vendored
Normal file
35
types/react-mic/index.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Type definitions for react-mic 12.4
|
||||
// Project: https://hackingbeauty.github.io/react-mic
|
||||
// Definitions by: mikaello <https://github.com/mikaello>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
/**
|
||||
* Record a user's voice and display as an oscillation (or frequency bars).
|
||||
*/
|
||||
export class ReactMic extends React.PureComponent<ReactMicProps> {}
|
||||
|
||||
export interface ReactMicProps {
|
||||
/** Set to true to begin recording */
|
||||
record?: boolean;
|
||||
|
||||
/** Available in React-Mic-Plus upgrade only */
|
||||
pause?: boolean;
|
||||
|
||||
visualSetting?: 'sinewave' | 'frequencyBars';
|
||||
|
||||
className?: string;
|
||||
|
||||
/** Callback that is executed when audio stops recording */
|
||||
onStop?: (recordedData: Blob) => void;
|
||||
|
||||
/** Callback that is executed when chunk of audio is available */
|
||||
onData?: (recordedData: Blob) => void;
|
||||
|
||||
/** Sound wave color */
|
||||
strokeColor?: string;
|
||||
|
||||
/** Background color */
|
||||
backgroundColor?: string;
|
||||
}
|
||||
18
types/react-mic/react-mic-tests.tsx
Normal file
18
types/react-mic/react-mic-tests.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { ReactMic } from 'react-mic';
|
||||
|
||||
class ReactMicTest extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<ReactMic
|
||||
record={true}
|
||||
className="sound-wave"
|
||||
onStop={data => console.log(data)}
|
||||
onData={data => console.log(data)}
|
||||
strokeColor="#000000"
|
||||
backgroundColor="#FF4081"
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
25
types/react-mic/tsconfig.json
Normal file
25
types/react-mic/tsconfig.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-mic-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-mic/tslint.json
Normal file
1
types/react-mic/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user