Skip to content
Permalink
Browse files

fix(connectable-binding): remove the silent limit of 100 observers pe…

…r expression

fixes #742
  • Loading branch information...
fkleuver committed Mar 15, 2019
1 parent 67bc269 commit 56ba36daa0429f1164fb78208c3d082147f7f6bb
Showing with 13 additions and 4 deletions.
  1. +13 −4 src/connectable-binding.js
@@ -1,12 +1,20 @@
import {sourceContext} from './call-context';


const slotNames = [];
const versionSlotNames = [];

for (let i = 0; i < 100; i++) {
slotNames.push(`_observer${i}`);
versionSlotNames.push(`_observerVersion${i}`);
let lastSlot = -1;
function ensureEnoughSlotNames(currentSlot) {
if (currentSlot === lastSlot) {
lastSlot += 5;
const ii = slotNames.length = versionSlotNames.length = lastSlot + 1;
for (let i = currentSlot + 1; i < ii; ++i) {
slotNames[i] = `_observer${i}`;
versionSlotNames[i] = `_observerVersion${i}`;
}
}
}
ensureEnoughSlotNames(-1);

function addObserver(observer) {
// find the observer.
@@ -34,6 +42,7 @@ function addObserver(observer) {
this._version = 0;
}
this[versionSlotNames[i]] = this._version;
ensureEnoughSlotNames(i);
}

function observeProperty(obj, propertyName) {

0 comments on commit 56ba36d

Please sign in to comment.
You can’t perform that action at this time.