Make the function call-rate limiting a generic thing and use it in more places.

This commit is contained in:
David Baker 2016-02-04 18:06:24 +00:00
parent 75ff4f0f95
commit 63776509a6
4 changed files with 49 additions and 34 deletions

View file

@ -41,6 +41,7 @@ var Resend = require("../../Resend");
var SlashCommands = require("../../SlashCommands");
var dis = require("../../dispatcher");
var Tinter = require("../../Tinter");
var rate_limited_func = require('../../ratelimitedfunc');
var PAGINATE_SIZE = 20;
var INITIAL_SIZE = 20;
@ -617,7 +618,7 @@ module.exports = React.createClass({
}
},
_updateTabCompleteList: function(room) {
_updateTabCompleteList: new rate_limited_func(function(room) {
if (!room || !this.tabComplete) {
return;
}
@ -626,7 +627,7 @@ module.exports = React.createClass({
CommandEntry.fromCommands(SlashCommands.getCommandList())
)
);
},
}, 500),
_initialiseMessagePanel: function() {
var messagePanel = ReactDOM.findDOMNode(this.refs.messagePanel);