readonly loaded boolean if the buffer is loaded

This commit is contained in:
Yotam Mann 2017-05-21 20:25:35 -07:00
parent 7cd7bb1536
commit a6bb882758
2 changed files with 14 additions and 0 deletions

View file

@ -365,6 +365,19 @@ define(["Tone/core/Tone", "Tone/core/Buffer", "Tone/source/Source", "Tone/source
}
});
/**
* If all the buffer is loaded
* @memberOf Tone.Player#
* @type {Boolean}
* @name loaded
* @readOnly
*/
Object.defineProperty(Tone.Player.prototype, "loaded", {
get : function(){
return this._buffer.loaded;
}
});
/**
* Dispose and disconnect.
* @return {Tone.Player} this

View file

@ -41,6 +41,7 @@ define(["helper/Basic", "Tone/source/Player", "helper/Offline",
it("loads a url which was passed in", function(done){
var player = new Player("./audio/sine.wav", function(){
expect(player.loaded).to.be.true;
player.dispose();
done();
});