1 decade ago by Joncom
It would be nice if the engine saw a fix for this issue which has been mentioned already (in the private forum):
The way in which
For example, MIDI.js cannot be used with Impact so long as this is not fixed, because the necessary
The result is that the
The fix appears to be a simple one (courtesy of vincentpiel):
The way in which
erase and random functions have been added to the Array prototype mess with enumeration and make it difficult to use other JavaScript libraries in tandem with Impact.For example, MIDI.js cannot be used with Impact so long as this is not fixed, because the necessary
MIDI.loadPlugin function eventually works its way to these lines:
for (var key in conf.items) {
self.queue.push(conf.items[key]);
}
The result is that the
erase and random functions are pushed into the queue array, breaking the plugin.The fix appears to be a simple one (courtesy of vincentpiel):
/* impact.js */
Object.defineProperty(Array.prototype,'erase', { value : eraseItemFromArray } );
function eraseItemFromArray(item) {
var i=this.indexOf(item);
if (i>=0) this.splice(i, 1);
return this;
};
Object.defineProperty(Array.prototype,'random', { value : randomItem } );
function randomItem() {
return this[ 0 | (Math.random() * this.length) ];
};
