goldfire/howler.js — pull request #186 by Rob--W (2014-07-22 23:56:21+00:00)
Title: Push all method calls in a queue before load

Previously, when a method is called before the sound is loaded,
the method call would be added to an event queue, but NEVER
removed again. Consequently, when the sound is played again, the
queued method is called again.

Here is an example that demonstrates the consequences:

```js
var h = new Howl({urls:['http://goldfirestudios.com/proj/howlerjs/sound.mp3']})
// Note: sound is not loaded, so the following is queued.
h.volume(1);
h.on('load', function() {
h.volume(0);
// Sound should be silent, but instead it is at volume 1!
h.play();
})
```

This patch replaces the erroneous "on('load'," implementation with
new internal methods. When methods are called before the sound is
loaded, the methods are pushed on a queue. When the sound is ready,
the queue is drained in FIFO order.

This patch might fix #164 as well.

(Another way to fix the bug is by implementing an once() method which
adds an event listener to an event queue, and removes the listener
after calling the method one time. However the implementation of the
event emitter is terribly broken as I pointed out in #184, so I decided to use
a queue specific for this purpose.)