Use arrow functions for this binding

This commit is contained in:
Kevin Sawicki 2016-03-11 14:08:14 -08:00
parent 28e9d87d86
commit 3556507ab9

View file

@ -44,16 +44,12 @@ class WebViewAttribute {
// Defines this attribute as a property on the webview node.
defineProperty() {
return Object.defineProperty(this.webViewImpl.webviewNode, this.name, {
get: (function(_this) {
return function() {
return _this.getValue();
};
})(this),
set: (function(_this) {
return function(value) {
return _this.setValue(value);
};
})(this),
get: () => {
return this.getValue();
},
set: (value) => {
return this.setValue(value);
},
enumerable: true
});
}
@ -203,20 +199,18 @@ class SrcAttribute extends WebViewAttribute {
// spawns off a new process.
setupMutationObserver() {
var params;
this.observer = new MutationObserver((function(_this) {
return function(mutations) {
this.observer = new MutationObserver((mutations) => {
var i, len, mutation, newValue, oldValue;
for (i = 0, len = mutations.length; i < len; i++) {
mutation = mutations[i];
oldValue = mutation.oldValue;
newValue = _this.getValue();
newValue = this.getValue();
if (oldValue !== newValue) {
return;
}
_this.handleMutation(oldValue, newValue);
this.handleMutation(oldValue, newValue);
}
};
})(this));
});
params = {
attributes: true,
attributeOldValue: true,