From 96c6cd0ab06070d22b5eedd008cd37272a1f7ef5 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Wed, 27 Nov 2013 14:21:56 +0100 Subject: [PATCH] Documenting limitations of forEach and forEachInExtent Because the tree's structure changes when nodes are inserted, updated or deleted, no modifications are allowed in a forEach loop. --- src/ol/structs/rbush.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ol/structs/rbush.js b/src/ol/structs/rbush.js index 88c21b6c73..dc6d3dfb97 100644 --- a/src/ol/structs/rbush.js +++ b/src/ol/structs/rbush.js @@ -379,6 +379,8 @@ ol.structs.RBush.prototype.condense_ = function(path) { /** + * Calls a callback function with each node in the tree. Inside the callback, + * no tree modifications (insert, update, remove) can be made. * @param {function(this: S, T): *} callback Callback. * @param {S=} opt_obj Scope. * @return {*} Callback return value. @@ -420,6 +422,8 @@ ol.structs.RBush.prototype.forEach_ = function(node, callback, opt_obj) { /** + * Calls a callback function with each node in the provided extent. Inside the + * callback, no tree modifications (insert, update, remove) can be made. * @param {ol.Extent} extent Extent. * @param {function(this: S, T): *} callback Callback. * @param {S=} opt_obj Scope.