Replace unnecessary bind(this) and var self = this statements with arrow functions in remaining src/ files

This commit is contained in:
Jonas Jenwald 2017-05-03 16:39:54 +02:00
parent e42fc546a0
commit 6c81b8e6dd
7 changed files with 86 additions and 103 deletions

View file

@ -64,7 +64,7 @@ var DOMCMapReaderFactory = (function DOMCMapReaderFactoryClosure() {
if (!name) {
return Promise.reject(new Error('CMap name must be specified.'));
}
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
var url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
var request = new XMLHttpRequest();
@ -73,7 +73,7 @@ var DOMCMapReaderFactory = (function DOMCMapReaderFactoryClosure() {
if (this.isCompressed) {
request.responseType = 'arraybuffer';
}
request.onreadystatechange = function () {
request.onreadystatechange = () => {
if (request.readyState !== XMLHttpRequest.DONE) {
return;
}
@ -96,10 +96,10 @@ var DOMCMapReaderFactory = (function DOMCMapReaderFactoryClosure() {
reject(new Error('Unable to load ' +
(this.isCompressed ? 'binary ' : '') +
'CMap at: ' + url));
}.bind(this);
};
request.send(null);
}.bind(this));
});
},
};