Skip to content

Instantly share code, notes, and snippets.

@karlbohlmark
Last active August 29, 2015 14:13
Show Gist options
  • Save karlbohlmark/12eb15c4f99559985515 to your computer and use it in GitHub Desktop.
Save karlbohlmark/12eb15c4f99559985515 to your computer and use it in GitHub Desktop.
// 1: Använda konstruktorer
function Pitcher () {
// Maps playoutStreamId into a key for outputStats
this.outputs = {};
// Statistics for outputs. Indexed by "<playerId>-<channelId>"
this.outputStats = {};
// Start timestamp for streams. Indexed by playoutStreamId
this.outputStart = {};
this.timer = null;
}
Pitcher.prototype.resetConfiguration = function(cb) {
var self = this
async.waterfall( [
function(cb) {
self.ensureAdaptiveGroups([], cb);
},
function(cb) {
self.ensureInputs([], cb);
},
function(cb, t1, t2) {
self.removeOutputs(cb);
}
], cb)
};
// 2: Använda generators
Pitcher.prototype.resetConfiguration = function *() {
yield this.ensureAdaptiveGroups([]);
yield this.ensureInputs([]);
yield this.removeOutputs();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment