environment: Replace monkey-patched method with Symbol.iterator

This allows using the actor itself as iterator:

  for (let child of container)
      doStuff(child);

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1269
This commit is contained in:
Florian Müllner 2020-05-19 21:29:49 +02:00
parent 8d4e650a95
commit e20cf1ac78

View File

@ -285,7 +285,7 @@ function init() {
_easeActorProperty(this, 'value', target, params); _easeActorProperty(this, 'value', target, params);
}; };
Clutter.Actor.prototype.iterate_children = function* () { Clutter.Actor.prototype[Symbol.iterator] = function* () {
for (let c = this.get_first_child(); c; c = c.get_next_sibling()) for (let c = this.get_first_child(); c; c = c.get_next_sibling())
yield c; yield c;
}; };