Export types for react-sound package (#29671)

This commit is contained in:
Konstantin
2018-10-12 10:05:49 -07:00
committed by Andy
parent 7315e28618
commit 79f404e22b
2 changed files with 30 additions and 27 deletions
+27 -24
View File
@@ -6,29 +6,32 @@
import * as React from "react";
declare namespace ReactSound {
type PlayStatus = 'PLAYING' | 'STOPPED' | 'PAUSED';
interface ReactSoundProps {
url: string;
playStatus: PlayStatus;
playFromPosition?: number;
position?: number;
volume?: number;
playbackRate?: number;
autoLoad?: boolean;
loop?: boolean;
onError?: () => void;
onLoading?: () => void;
onLoad?: () => void;
onPlaying?: () => void;
onPause?: () => void;
onResume?: () => void;
onStop?: () => void;
onFinishedPlaying?: () => void;
onBufferChange?: () => void;
}
export enum PlayStatus {
Playing = 'PLAYING',
Stopped = 'STOPPED',
Paused = 'PAUSED'
}
declare const ReactSound: React.ComponentClass<ReactSound.ReactSoundProps>;
export = ReactSound;
export interface ReactSoundProps {
url: string;
playStatus: PlayStatus;
playFromPosition?: number;
position?: number;
volume?: number;
playbackRate?: number;
autoLoad?: boolean;
loop?: boolean;
onError?: () => void;
onLoading?: () => void;
onLoad?: () => void;
onPlaying?: () => void;
onPause?: () => void;
onResume?: () => void;
onStop?: () => void;
onFinishedPlaying?: () => void;
onBufferChange?: () => void;
}
declare const ReactSound: React.ComponentClass<ReactSoundProps>;
export default ReactSound;
+3 -3
View File
@@ -1,10 +1,10 @@
import ReactSound from "react-sound";
import ReactSound, { PlayStatus } from "react-sound";
import * as React from "react";
const ReactSoundRequiredOptions: JSX.Element = (
<ReactSound
url="http://test.com"
playStatus="STOPPED"
playStatus={PlayStatus.Stopped}
/>
);
@@ -13,7 +13,7 @@ const callbackFn = () => ({});
const ReactSoundAllOptions: JSX.Element = (
<ReactSound
url="http://test.com/audio.mp3"
playStatus="STOPPED"
playStatus={PlayStatus.Paused}
playFromPosition={0}
position={0}
volume={0}