Skip to content

Commit

Permalink
Substitute util.bind with Function.bind (#618)
Browse files Browse the repository at this point in the history
ScheduleCreationPopup._onClickListeners() uses Function.bind since April 2018, and
TimeCreationGuide._onDrag uses it since Mai 2017, so Function.bind can be used
everywhere and util.bind is not necessary.

• Replace util.bind(x,y) with x.bind(y)
• Update README.md with the minimal supported versions.
  • Loading branch information
dilyanpalauzov committed Jul 27, 2020
1 parent c9bc4a7 commit 5adbd7b
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/js/common/autoScroll.js
Expand Up @@ -148,7 +148,7 @@ AutoScroll.prototype._onMouseDown = function(mouseDownEvent) {
}

window.clearInterval(this._intervalID);
this._intervalID = window.setInterval(util.bind(this._onTick, this), SCROLL_INTERVAL);
this._intervalID = window.setInterval(this._onTick.bind(this), SCROLL_INTERVAL);

domevent.on(global, {
'mousemove': this._onMouseMove,
Expand Down
2 changes: 1 addition & 1 deletion src/js/common/common.js
Expand Up @@ -150,7 +150,7 @@ module.exports = {
},

/**
* Set 'title' attribute for all elements that has exceeded content in
* Set 'title' attribute for all elements that have exceeded content in
* container
* @param {string} selector - CSS selector {@see domutil#find}
* @param {HTMLElement} container - container element
Expand Down
3 changes: 1 addition & 2 deletions src/js/common/reqAnimFrame.js
Expand Up @@ -4,7 +4,6 @@
*/
'use strict';

var util = require('tui-code-snippet');
var requestFn,
cancelFn;

Expand Down Expand Up @@ -40,7 +39,7 @@ module.exports = {
* @returns {number} Unique id
*/
requestAnimFrame: function(fn, context) {
return requestFn.call(global, util.bind(fn, context));
return requestFn.call(global, fn.bind(context));
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/js/factory/controller.js
Expand Up @@ -20,7 +20,7 @@ function mixin(from, to, propertyName) {
var obj = to[propertyName] = {};

util.forEach(from, function(method, methodName) {
obj[methodName] = util.bind(method, to);
obj[methodName] = method.bind(to);
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/js/handler/time/core.js
Expand Up @@ -49,7 +49,7 @@ var timeCore = {
/**
* @param {MouseEvent} mouseEvent - mouse event object to get common event data.
* @param {object} [extend] - object to extend event data before return.
* @returns {object} - common event data for time.*
* @returns {object} - common event data for time
*/
return function(mouseEvent, extend) {
var mouseY = Point.n(domevent.getMousePosition(mouseEvent, container)).y,
Expand Down Expand Up @@ -80,7 +80,7 @@ var timeCore = {
* @param {TZDate} startDate - start date
* @param {TZDate} endDate - end date
* @param {number} hourStart Can limit of render hour start.
* @returns {object} - common event data for time.* from mouse event.
* @returns {object} - common event data for time from mouse event.
*/
_retriveScheduleDataFromDate: function(timeView, startDate, endDate, hourStart) {
var viewTime = timeView.getDate();
Expand Down
4 changes: 2 additions & 2 deletions src/js/view/week/timeGrid.js
Expand Up @@ -545,7 +545,7 @@ TimeGrid.prototype.attachEvent = function() {
clearTimeout(this.timerID);
this.intervalID = this.timerID = this.rAnimationFrameID = null;

this.timerID = setTimeout(util.bind(this.onTick, this), (SIXTY_SECONDS - new TZDate().getSeconds()) * 1000);
this.timerID = setTimeout(this.onTick.bind(this), (SIXTY_SECONDS - new TZDate().getSeconds()) * 1000);

domevent.on(this.stickyContainer, 'click', this._onClickStickyContainer, this);
};
Expand Down Expand Up @@ -600,7 +600,7 @@ TimeGrid.prototype.onTick = function() {
}

if (!this.intervalID) {
this.intervalID = setInterval(util.bind(this.onTick, this), HOURMARKER_REFRESH_INTERVAL);
this.intervalID = setInterval(this.onTick.bind(this), HOURMARKER_REFRESH_INTERVAL);
}
this.refreshHourmarker();
};
Expand Down

0 comments on commit 5adbd7b

Please sign in to comment.