signalTracker: Avoid creating a temporary keys array when clearing

We used to create a temporary array of signal tracker keys and then to
iterate through them in order to untrack the objects, but the Map's can
be iterated directly so let's just use their native forEach.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2366>
This commit is contained in:
Marco Trevisan (Treviño) 2022-07-06 17:47:14 +02:00
parent 68ceed5c28
commit 74720f250e

View File

@ -138,7 +138,7 @@ class SignalTracker {
* @returns {void} * @returns {void}
*/ */
clear() { clear() {
[...this._map.keys()].forEach(obj => this.untrack(obj)); this._map.forEach((_, obj) => this.untrack(obj));
} }
/** /**