mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-03 11:14:27 +02:00
Create simple debounce and throttle instead of _.
This commit is contained in:
parent
ae0030daa7
commit
e6d7edd130
7 changed files with 43 additions and 8 deletions
|
@ -7,6 +7,8 @@ var intl = require('../intl');
|
|||
var log = require('../log');
|
||||
var Constants = require('../util/constants');
|
||||
var KeyboardListener = require('../util/keyboard').KeyboardListener;
|
||||
var debounce = require('../util/debounce');
|
||||
var throttle = require('../util/throttle');
|
||||
|
||||
var BaseView = Backbone.View.extend({
|
||||
getDestination: function() {
|
||||
|
@ -106,7 +108,7 @@ var GeneralButton = ContainedBase.extend({
|
|||
|
||||
click: function() {
|
||||
if (!this.clickFunc) {
|
||||
this.clickFunc = _.throttle(
|
||||
this.clickFunc = throttle(
|
||||
this.sendClick.bind(this),
|
||||
500
|
||||
);
|
||||
|
@ -580,7 +582,7 @@ var CanvasTerminalHolder = BaseView.extend({
|
|||
|
||||
// If the entire window gets resized such that the terminal is outside the view, then
|
||||
// move it back into the view, and expand/shrink it vertically as necessary.
|
||||
$(window).on('resize', _.debounce(this.recalcLayout.bind(this), 300));
|
||||
$(window).on('resize', debounce(this.recalcLayout.bind(this), 300));
|
||||
|
||||
if (options.additionalClass) {
|
||||
this.$el.addClass(options.additionalClass);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue