UNPKG

rehowl

Version:

Opinionated React wrapper for Howler.js

22 lines (21 loc) 795 B
import { useHowl } from './useHowl.js'; /** * Render prop access to a Howl instance for use with `<Play />`. * * Recommended when using Rehowl from a class component. If you're * using a function component, it's best to use `useHowl`. */ export function Rehowl(props) { var children = props.children, src = props.src, sprite = props.sprite, format = props.format, html5 = props.html5, preload = props.preload, xhr = props.xhr; var _a = useHowl({ src: src, sprite: sprite, format: format, html5: html5, preload: preload, xhr: xhr, }), howl = _a.howl, error = _a.error, state = _a.state, load = _a.load; if (!children || !howl) return null; return children({ howl: howl, error: error, state: state, load: load }); }