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