1 /** 2 * @class asset 3 * @description 4 * Refers to a stored asset from a datastream. 5 * 6 * Assets represent a stored chunk of useful data 7 * encoded into a format that the engine can use. 8 * Assets are used as the bridge between external resources 9 * and sandboxe itself. 10 * 11 */ 12 function asset() { 13 14 /** 15 * Returns the stored asset object containing usable data. 16 */ 17 this.get = function(){}; 18 19 /** 20 * Removes the asset from the program. 21 */ 22 this.remove = function(){}; 23 24 /** 25 * Attempts to dump the asset to a file 26 * 27 * The encoder extension specifies which encoder 28 * should handle writing the file. If the extension is not supported, the write will fail 29 * and false will be returned. True is returned if the dump was reported as successful 30 * by the encoder. 31 * @param {String} encoderExtension The type of file to write on disk. I.e. png 32 * @param {String} Name Name of the file to write. 33 */ 34 this.write = function(arrayOfSamples){}; 35 36 37 38 39 40 /** 41 * Returns whether this asset refers to a real asset or not. 42 * @type {Boolean} 43 */ 44 this.valid = true; 45 46 /** 47 * Returns the name of the asset. Read-only. 48 * @type {String} 49 */ 50 this.name = ""; 51 52 return this; 53 }