workspace: Use ES6 findIndex() method for getting window index

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/346
This commit is contained in:
verdre 2018-11-19 12:28:29 +01:00 committed by Florian Müllner
parent 6b0c8c9fe0
commit 3730314dd5
2 changed files with 2 additions and 12 deletions

View File

@ -1206,12 +1206,7 @@ var Workspace = class {
} }
_lookupIndex(metaWindow) { _lookupIndex(metaWindow) {
for (let i = 0; i < this._windows.length; i++) { return this._windows.findIndex(w => w.metaWindow == metaWindow);
if (this._windows[i].metaWindow == metaWindow) {
return i;
}
}
return -1;
} }
containsMetaWindow(metaWindow) { containsMetaWindow(metaWindow) {

View File

@ -319,12 +319,7 @@ var WorkspaceThumbnail = class {
} }
_lookupIndex(metaWindow) { _lookupIndex(metaWindow) {
for (let i = 0; i < this._windows.length; i++) { return this._windows.findIndex(w => w.metaWindow == metaWindow);
if (this._windows[i].metaWindow == metaWindow) {
return i;
}
}
return -1;
} }
syncStacking(stackIndices) { syncStacking(stackIndices) {