I created a custom object called Stream with the following structure:
function Stream(id, info, container){
var self = this;
this.id = id;
this.paddedId = ("00000" + this.id).substr(-5,5);
this.live = info['live'];
this.autoplay = info['autoplay'];
...
To instantiate an object, I use the code snippet below:
var stream = new Stream(1, streamInfo, "stream");
Sometimes, I need to create multiple objects of this type at once. I would like to find a cleaner way to initialize it while keeping my functions intact. Is there a way to achieve something similar to the code snippet below?
var stream = new Stream({
'id': 1,
'live': true,
'autoplay': false
});
If not exact, then perhaps a similar approach.