Add desktop notifications, overridable in the same way as other components (although it's not a react component). Also extend the flux dispatcher a little to be less dumb about dispatching while something else is already dispatching.

This commit is contained in:
David Baker 2015-07-03 11:12:54 +01:00
parent 947f389e51
commit fd20e82123
9 changed files with 288 additions and 3 deletions

View file

@ -17,4 +17,21 @@ limitations under the License.
'use strict';
var flux = require("flux");
module.exports = new flux.Dispatcher();
var extend = require("./extend");
var MatrixDispatcher = function() {
flux.Dispatcher.call(this);
};
extend(MatrixDispatcher.prototype, flux.Dispatcher.prototype);
MatrixDispatcher.prototype.dispatch = function(payload) {
if (this.dispatching) {
setTimeout(flux.Dispatcher.prototype.dispatch.bind(this, payload), 0);
} else {
this.dispatching = true;
flux.Dispatcher.prototype.dispatch.call(this, payload);
this.dispatching = false;
}
}
module.exports = new MatrixDispatcher();