Skip to content

Commit

Permalink
perf: Lift the required browser versions
Browse files Browse the repository at this point in the history
As of https://caniuse.com/#feat=mdn-javascript_builtins_function_bind Function.bind
is supported in IE +9, Edge +12 , Firefox +4, Chrome +7, Safari +5.1.

ScheduleCreationPopup._onClickListeners() uses Function.bind since April 2018, and
TimeCreationGuide._onDrag uses it since Mai 2017, so the aforementioned browser
versions are required that long.

• Replace util.bind(x,y) with x.bind(y)
• Update README.md with the minimal supported versions.
  • Loading branch information
dilyanpalauzov committed May 29, 2020
1 parent 6e0e133 commit c77b765
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -238,7 +238,7 @@ $('#calendar').tuiCalendar({
## 🌏 Browser Support
| <img src="https://user-images.githubusercontent.com/1215767/34348387-a2e64588-ea4d-11e7-8267-a43365103afe.png" alt="Chrome" width="16px" height="16px" /> Chrome | <img src="https://user-images.githubusercontent.com/1215767/34348590-250b3ca2-ea4f-11e7-9efb-da953359321f.png" alt="IE" width="16px" height="16px" /> Internet Explorer | <img src="https://user-images.githubusercontent.com/1215767/34348380-93e77ae8-ea4d-11e7-8696-9a989ddbbbf5.png" alt="Edge" width="16px" height="16px" /> Edge | <img src="https://user-images.githubusercontent.com/1215767/34348394-a981f892-ea4d-11e7-9156-d128d58386b9.png" alt="Safari" width="16px" height="16px" /> Safari | <img src="https://user-images.githubusercontent.com/1215767/34348383-9e7ed492-ea4d-11e7-910c-03b39d52f496.png" alt="Firefox" width="16px" height="16px" /> Firefox |
| :---------: | :---------: | :---------: | :---------: | :---------: |
| Yes | +9 | Yes | Yes | Yes |
| +7 | +9 | Yes | +5.1 | +4 |

## 🔧 Pull Request Steps

Expand Down
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
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 c77b765

Please sign in to comment.