Last active
August 29, 2015 14:13
-
-
Save karlbohlmark/12eb15c4f99559985515 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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