private _setupSpecificKeySubscription()

in src/StoreBase.ts [177:195]


    private _setupSpecificKeySubscription(keys: string[], callback: SubscriptionCallbackFunction,
            throttledUntil: number | undefined, bypassBlock: boolean): void {
        const existingMeta = StoreBase._pendingCallbacks.get(callback);
        StoreBase._updateExistingMeta(existingMeta, throttledUntil, bypassBlock);

        if (existingMeta === undefined) {
            // We need to clone keys in order to prevent accidental by-ref mutations
            StoreBase._pendingCallbacks.set(callback, { keys: [...keys], throttledUntil, bypassBlock });
        } else if (existingMeta.keys === null) {
            // Do nothing since it's already an all-key-trigger
        } else {
            // Add them all to the end of the list
            // Refrain from using spead operater here, this can result in a stack overflow if a large number of keys are triggered
            const keyCount = keys.length;
            for (let i = 0; i < keyCount; i++) {
                existingMeta.keys.push(keys[i]);
            }
        }
    }