aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2017-08-26 06:32:57 +0200
committerThomas Lange <code@nerdmind.de>2017-08-26 06:32:57 +0200
commit106dcf889104f026473bb0a5ee40eed9d3456b9a (patch)
treece364bfc68ab9a40d41c144307a14f93399c19c6
parentf5a16fca96554a054823736395c39d473b74594e (diff)
downloadbigpipe-106dcf889104f026473bb0a5ee40eed9d3456b9a.tar.gz
bigpipe-106dcf889104f026473bb0a5ee40eed9d3456b9a.tar.xz
bigpipe-106dcf889104f026473bb0a5ee40eed9d3456b9a.zip
Optimization: Some anonymous callback functions has been simplified with arrow functions which were introduced in ECMAScript 6 (2015).
-rwxr-xr-xstatic/bigpipe.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/static/bigpipe.js b/static/bigpipe.js
index 30511ea..b101f6a 100755
--- a/static/bigpipe.js
+++ b/static/bigpipe.js
@@ -99,10 +99,10 @@ BigPipe = (function() {
return false;
}
- let callback = function() {
+ const callback = () => {
PhaseDoneJS.handler(this, Resource.PHASE_DONE);
this.executeCallbacks();
- }.bind(this);
+ };
this.node.onload = callback;
this.node.onerror = callback;
@@ -157,13 +157,13 @@ BigPipe = (function() {
// Pagelet: Initialize the pagelet resources
//==============================================================================
Pagelet.prototype.initializeResources = function() {
- this.stylesheets.forEach(function(data) {
+ this.stylesheets.forEach(data => {
this.attachResource(new Resource(data, Resource.TYPE_STYLESHEET));
- }.bind(this));
+ });
- this.javascripts.forEach(function(data) {
+ this.javascripts.forEach(data => {
this.attachResource(new Resource(data, Resource.TYPE_JAVASCRIPT));
- }.bind(this));
+ });
};
//==============================================================================
@@ -175,7 +175,7 @@ BigPipe = (function() {
this.resources[type].forEach(function(resource) {
somethingExecuted = true;
resource.execute();
- }.bind(this));
+ });
return somethingExecuted;
};
@@ -197,11 +197,11 @@ BigPipe = (function() {
Pagelet.prototype.attachResource = function(resource) {
switch(resource.type) {
case Resource.TYPE_STYLESHEET:
- resource.registerCallback(this.onloadCSS.bind(this));
+ resource.registerCallback(() => this.onloadCSS());
break;
case Resource.TYPE_JAVASCRIPT:
- resource.registerCallback(this.onloadJS.bind(this));
+ resource.registerCallback(() => this.onloadJS());
break;
}