Sha256: 4389984a8b6491ddb903c4d588ba107bb8dc10bd8db2d199075c7df0720ba7a8

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

import { unwatch, watch } from './watching';
// ..........................................................
// DEPENDENT KEYS
//
export function addDependentKeys(desc, obj, keyName, meta) {
    // the descriptor has a list of dependent keys, so
    // add all of its dependent keys.
    let depKeys = desc._dependentKeys;
    if (depKeys === null || depKeys === undefined) {
        return;
    }
    for (let idx = 0; idx < depKeys.length; idx++) {
        let depKey = depKeys[idx];
        // Increment the number of times depKey depends on keyName.
        meta.writeDeps(depKey, keyName, meta.peekDeps(depKey, keyName) + 1);
        // Watch the depKey
        watch(obj, depKey, meta);
    }
}
export function removeDependentKeys(desc, obj, keyName, meta) {
    // the descriptor has a list of dependent keys, so
    // remove all of its dependent keys.
    let depKeys = desc._dependentKeys;
    if (depKeys === null || depKeys === undefined) {
        return;
    }
    for (let idx = 0; idx < depKeys.length; idx++) {
        let depKey = depKeys[idx];
        // Decrement the number of times depKey depends on keyName.
        meta.writeDeps(depKey, keyName, meta.peekDeps(depKey, keyName) - 1);
        // Unwatch the depKey
        unwatch(obj, depKey, meta);
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/@ember/-internals/metal/lib/dependent_keys.js
discourse-ember-source-3.5.1.1 dist/es/ember-metal/lib/dependent_keys.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-metal/lib/dependent_keys.js