New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rehowl

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rehowl

Opinionated React wrapper for Howler.js

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
41
decreased by-8.89%
Maintainers
1
Weekly downloads
 
Created
Source

Rehowl

An opinionated React wrapper for howler.js

Installation

Rehowl has react and howler as peer dependencies so that you can manage your own versions.

npm install --save-dev howler rehowl
yarn add -D howler rehowl

Quickstart

Hook interface

The recommended method to use Rehowl is through its custom hook and <Play /> element.

Similar to Howler, you initialize a Howl and then can play sounds from it.

import React from 'react'
import { useHowl, Play } from 'rehowl'

const MyComponent = () => {
  const { howl, state, error } = useHowl({
    src: ['sound1.mp3', 'sound1.wav']
  })
  return <Play howl={howl} />
}

Render props interface

In a class component, you must use the render props pattern with <Rehowl />.

import React, { Component } from 'react'
import { Rehowl, Play } from 'rehowl'

class MyComponent extends Component {
  render() {
    return (
      <Rehowl src={[ 'sound1.mp3', 'sound1.wav' ]}>{
        ({ howl, state, error }) => <Play howl={howl} />
      }</Rehowl>
    )
  }
}

Examples

For more examples (while documentation is still light), please see storybook stories.

Rationale / Why not react-howler

When deciding to use Howler in a React project, a quick Google Search brings you to react-howler.

There are a few issues that make ReactHowler unsuitable for my needs:

  • No support for playing multiple sounds on one Howl instance
  • No support for audio sprites
  • If you want to do more than the very basic API, you must break out the howler instance using refs
  • Use of componentWillReceiveProps

Overall, it feels much more like a barebones wrapper for Howler that doesn't really give you any help when trying to integrate it into your components.

My main goals in this project are to make a library that feels like Howler, if Howler were built for React.

Keywords

FAQs

Package last updated on 11 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc