npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

int-sound

v1.0.11

Published

Turn a DOM element into a sound button.

Downloads

11

Readme

int-sound

IntSound is an abstraction layer on soundjs. It's used to easily transform jQuery selections into sound buttons.

Usage

Old-fashioned script embed

<script type="text/javascript" src="/your/path/int-sound/lib/soundjs.min.js"></script>
<script type="text/javascript" src="/your/path/int-sound/intSound.js"></script>
<!--[if lte IE8]><script type="text/javascript" src="/your/path/int-sound/lib/flashaudioplugin-0.6.1.min.js"></script><![endif]-->

<!-- intSound is now available at window.intSound -->
<script type="text/javascript">
  IntSound.tie($('.my_btn'), 'sounds', 'mysound');
</script>

Browserify

var intSound = require('./intSound');
intSound.tie($('.my_btn'), 'sounds', 'mysound');

Methods

.tie($btn, sound_dir, sound_id, conf)

When $btn is clicked, a specified sound will load and play. During loading, $btn will gain the class loading_sound. When playing a sound, $btn will gain the class playing_sound.

  • $btn: A jQuery selection.
  • sound_dir: String. The directory in which the sound file is stored, e.g. "sound"
  • sound_id: String. The name of the sound file without the extension.
  • opts: A dictionary of configuration options.
    • behavior: String. If set to "key," the button will behave like a piano key, i.e. it will not stop any other sounds that are currently playing. The default behavior is for the button to stop all other sounds.
    • onStartLoad: Function. Fires after the sound starts loading. Useful for changing the state of the button during load. This fires after a short delay and does not fire if the sound loads before that delay ends. The default delay is 300 milliseconds and can be changed with loadDelay.
    • onEndLoad: Function. Fires when the sound stops loading.
    • loadDelay: Integer. The number of milliseconds to wait after loading has initiated before firing the onStartLoad function, if specified.

.stopAll()

Stops all sounds from playing, and removes the class playing_sound from all elements.

.untie($btn)

Removes a listener added by tie() from the specified button.

Compatibility

(This has not yet been tested!)

Compatibility with IE8 requires additional JS. This is loaded asynchronously during runtime via RequireJS if RequireJS is on the page.

For a solution that does not use RequireJS, directly embed lib/soundjs-0.6.1.min.js on the page using IE conditional tags.