rehowl-r18
Version:
Opinionated React wrapper for Howler.js with React 18
28 lines (27 loc) • 1.11 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var useHowl_1 = __importDefault(require("./useHowl"));
/**
* 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`.
*/
function Rehowl(props) {
var children = props.children, src = props.src, sprite = props.sprite, format = props.format, html5 = props.html5, preload = props.preload, xhrWithCredentials = props.xhrWithCredentials;
var _a = useHowl_1.default({
src: src,
sprite: sprite,
format: format,
html5: html5,
preload: preload,
xhrWithCredentials: xhrWithCredentials,
}), 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 });
}
exports.default = Rehowl;