Use arrow functions for this binding
This commit is contained in:
parent
28e9d87d86
commit
3556507ab9
1 changed files with 17 additions and 23 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue