Socket
Socket
Sign inDemoInstall

chem

Package Overview
Dependencies
1
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.4 to 0.4.5

1

lib/engine.js

@@ -146,2 +146,3 @@ var vec2d = require('vec2d');

self.emit('buttondown', buttonId);
self.canvas.focus();
return self.bubbleEvent(event);

@@ -148,0 +149,0 @@ });

module.exports = Sound;
function Sound(url) {
this.audioPool = [new Audio(url)];
function Sound(src) {
this.currentSrc = src;
this.audioPool = [new Audio(src)];
this.maxPoolSize = 1000;
this.volume = 1;
this.preload = "auto";
this.applySettings();
}

@@ -19,5 +25,29 @@

}
var newAudio = new Audio(this.audioPool[0].currentSrc);
newAudio.play();
this.audioPool.push(newAudio);
if (this.audioPool.length < this.maxPoolSize) {
var newAudio = new Audio(this.currentSrc);
this.applySettingsToAudio(newAudio);
newAudio.play();
this.audioPool.push(newAudio);
}
};
Sound.prototype.setVolume = function(vol) {
this.volume = vol;
this.applySettings();
};
Sound.prototype.setPreload = function(preload) {
this.preload = preload;
this.applySettings();
};
Sound.prototype.applySettings = function() {
for (var i = 0; i < this.audioPool.length; ++i) {
this.applySettingsToAudio(this.audioPool[i]);
}
}
Sound.prototype.applySettingsToAudio = function(audio) {
audio.volume = this.volume;
audio.preload = this.preload;
}

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Andrew Kelley <superjoe30@gmail.com>",
"version": "0.4.4",
"version": "0.4.5",
"main": "index.js",

@@ -8,0 +8,0 @@ "license": "MIT",

@@ -176,2 +176,3 @@ # chem

* [Meteor Attack](https://github.com/superjoe30/meteor-attack) - dodge meteors in space
* [Disinfecticide](https://github.com/superjoe30/disinfecticide) - use extreme measures to control a deadly disease outbreak.
* [holocaust](https://github.com/superjoe30/holocaust/) -

@@ -445,2 +446,10 @@ rebuild society after a nuclear holocaust ravages the world

`sound.setVolume(value)`
Sets the `volume` property. Same as HTML5 Audio object.
`sound.setPreload(value)`
Sets the `preload` property. Same as HTML5 Audio object.
#### Sprite

@@ -655,2 +664,7 @@

### 0.4.5
* sound: ability to set preload and volume properties
* focus canvas on mouse down - fixes focus problem
### 0.4.4

@@ -657,0 +671,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc