Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-use-sound

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-use-sound

Sound Effects for Ember Apps

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ember-use-sound

Add rich sound effects to your interactions in Ember!

This addon takes large inspiration from the React hook package use-sound by Josh Comeau. Be sure to check out this great article he wrote which summarizes the huge benefits you get by enriching the user experience with a 2nd sensory input.

Utilizes the library ember-resources under the hood to provide a Resource for loading and playing sounds via the wonderful Howler.js library.

This is a V2-format Addon with V1 compatibility

Compatibility

  • ember-source v3.25+
  • typeScript v4.2+
  • ember-auto-import v2+

Installation

npm install ember-use-sound
# or
yarn add ember-use-sound
# or
ember install ember-use-sound

Setup

Any audio file you plan on referencing should be added within the /public/assets directory of your ember application. They can then be referenced via relative paths in your code.

Example

import { Component } from '@glimmer/component';
import { useSound } from 'ember-use-sound';

class Button extends Component {
  popIn = useSound(this, () => ['/assets/pop-in.mp3']);
  popOut = useSound(this, () => ['/assets/pop-out.mp3']);
}
<button 
  type='button'
  {{on 'mousedown' this.popIn.play}}
  {{on 'mouseup' this.popOut.play}}  
>
  Click me!
</button>

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 16 Dec 2021

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