Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: chrome/browser/resources/md_history/history_list_behavior.js

Issue 2597573002: MD History/Downloads: convert .bind(this) and function property values to use => (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_history/history_list_behavior.js
diff --git a/chrome/browser/resources/md_history/history_list_behavior.js b/chrome/browser/resources/md_history/history_list_behavior.js
index b5f5b5c42aa8bba5db694a6788073a351b086caf..474c86bb0599d8bba965b72de0a14ce6e610b3d9 100644
--- a/chrome/browser/resources/md_history/history_list_behavior.js
+++ b/chrome/browser/resources/md_history/history_list_behavior.js
@@ -35,7 +35,7 @@ var HistoryListBehavior = {
*/
selectedPaths: {
type: Object,
- value: /** @return {!Set<string>} */ function() { return new Set(); }
+ value: /** @return {!Set<string>} */ () => new Set(),
},
lastSelectedPath: String,
@@ -79,10 +79,7 @@ var HistoryListBehavior = {
* Deselect each item in |selectedPaths|.
*/
unselectAllItems: function() {
- this.selectedPaths.forEach(function(path) {
- this.set(path + '.selected', false);
- }.bind(this));
-
+ this.selectedPaths.forEach(path => this.set(path + '.selected', false));
this.selectedPaths.clear();
},
@@ -94,16 +91,14 @@ var HistoryListBehavior = {
*/
deleteSelected: function() {
var toBeRemoved =
- Array.from(this.selectedPaths.values()).map(function(path) {
- return this.get(path);
- }.bind(this));
+ Array.from(this.selectedPaths.values()).map(path => this.get(path));
md_history.BrowserService.getInstance()
.deleteItems(toBeRemoved)
- .then(function() {
+ .then(() => {
this.removeItemsByPath(Array.from(this.selectedPaths));
this.fire('unselect-all');
- }.bind(this));
+ });
},
/**
@@ -171,7 +166,7 @@ var HistoryListBehavior = {
var splices = [];
node.indexes.sort(function(a, b) { return b - a; });
- node.indexes.forEach(function(index) {
+ node.indexes.forEach(index => {
if (node.leaf || this.removeItemsBeneathNode_(node.children[index])) {
var item = array.splice(index, 1)[0];
splices.push({
@@ -182,7 +177,7 @@ var HistoryListBehavior = {
type: 'splice'
});
}
- }.bind(this));
+ });
if (array.length == 0 && node.currentPath.indexOf('.') != -1)
return true;
@@ -224,7 +219,7 @@ var HistoryListBehavior = {
var selected = !this.selectedPaths.has(item.path);
- paths.forEach(function(path) {
+ paths.forEach(path => {
this.set(path + '.selected', selected);
if (selected) {
@@ -233,7 +228,7 @@ var HistoryListBehavior = {
}
this.selectedPaths.delete(path);
- }.bind(this));
+ });
this.lastSelectedPath = itemPath;
},

Powered by Google App Engine
This is Rietveld 408576698