From 45220e310cd12da9bd7b0b07fe3509def063a60c Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Mon, 12 Dec 2016 22:05:17 +0530 Subject: Use `bind` instead of currying to access outer context --- app/assets/javascripts/build.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/build.js b/app/assets/javascripts/build.js index 5c6f0083e57..8646ce99726 100644 --- a/app/assets/javascripts/build.js +++ b/app/assets/javascripts/build.js @@ -86,15 +86,13 @@ return $.ajax({ url: this.buildUrl, dataType: 'json', - success: (function(_this) { - return function(buildData) { - $('.js-build-output').html(buildData.trace_html); - if (removeRefreshStatuses.indexOf(buildData.status) >= 0) { - _this.initScrollMonitor(); - return $('.js-build-refresh').remove(); - } - }; - })(this) + success: function(buildData) { + $('.js-build-output').html(buildData.trace_html); + if (removeRefreshStatuses.indexOf(buildData.status) >= 0) { + this.initScrollMonitor(); + return $('.js-build-refresh').remove(); + } + }.bind(this) }); }; -- cgit v1.2.1