From 3556507ab984fc0ac0bdd6fe5d4da52cd29e0e9a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 11 Mar 2016 14:08:14 -0800 Subject: [PATCH] Use arrow functions for this binding --- lib/renderer/web-view/web-view-attributes.js | 40 +++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/lib/renderer/web-view/web-view-attributes.js b/lib/renderer/web-view/web-view-attributes.js index bb7847fe16..e85fe71618 100644 --- a/lib/renderer/web-view/web-view-attributes.js +++ b/lib/renderer/web-view/web-view-attributes.js @@ -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) { - var i, len, mutation, newValue, oldValue; - for (i = 0, len = mutations.length; i < len; i++) { - mutation = mutations[i]; - oldValue = mutation.oldValue; - newValue = _this.getValue(); - if (oldValue !== newValue) { - return; - } - _this.handleMutation(oldValue, newValue); + 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(); + if (oldValue !== newValue) { + return; } - }; - })(this)); + this.handleMutation(oldValue, newValue); + } + }); params = { attributes: true, attributeOldValue: true,