Cant this be done more simple?

Enviado desde mi BlackBerry

-----Original Message-----
From: Tomas Neme <notifications@github.com>
Date: Sat, 13 Apr 2013 16:36:45 
To: inaes-tic/mbc-mosto<mbc-mosto@noreply.github.com>
Reply-To: inaes-tic/mbc-mosto <reply@reply.github.com>
Cc: Juan Martin Runge<jmrunge@gmail.com>
Subject: Re: [mbc-mosto] NOT FOR MERGE please review (#54)

> +    },
> +    source: null,
> +    on_air: false,
> +};
> +
> +function CaspaDriver() {
> +    events.EventEmitter.call(this);
> +    var self = this;
> +    this.status = _.clone(defaults);
> +    this.publisher = mbc.pubsub();
> +
> +    CaspaDriver.prototype.setupAll = function() {
> +        var setups = [
> +            this.setupStatus
> +        ];
> +        var sendReady = _.after(setups.length, function() {

`_.after` creates a function that calls the wrapped function only after it's been called `n` times. So I just call `sendReady` over and over, and `self.emit` will only be called once in the `n`th call. This is used to be able to call some function only after a number of async processes have finished

---
Reply to this email directly or view it on GitHub:
https://github.com/inaes-tic/mbc-mosto/pull/54/files#r3784765