Skip to content

Commit f4df466

Browse files
committed
Add comments
1 parent 8fba53f commit f4df466

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/utils/debounce.html

+4
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
* @return {void}
128128
*/
129129
Polymer.enqueueDebouncer = function(debouncer) {
130+
// Re-enqueued debouncers are put at the end of the queue; for Set, this
131+
// means removing and re-adding, since forEach traverses insertion order
130132
if (debouncerQueue.has(debouncer)) {
131133
debouncerQueue.delete(debouncer);
132134
}
@@ -135,6 +137,8 @@
135137

136138
Polymer.flushDebouncers = function() {
137139
const didFlush = Boolean(debouncerQueue.size);
140+
// If new debouncers are added while flushing, Set.forEach will ensure
141+
// newly added ones are also flushed
138142
debouncerQueue.forEach(debouncer => {
139143
try {
140144
debouncer.flush();

0 commit comments

Comments
 (0)