@zedux/atoms
Version:
A Molecular State Engine for React
31 lines (30 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.prefix = exports.haveDepsChanged = exports.Static = exports.External = exports.Explicit = void 0;
/**
* The EdgeFlags. These are used as bitwise flags.
*
* The flag score determines job priority in the scheduler. Scores range from
* 0-7. Lower score = higher prio. Examples:
*
* 0 = implicit-internal-dynamic
* 3 = explicit-external-dynamic
* 7 = explicit-external-static
*
* IMPORTANT: Keep these in-sync with the copies in the react package -
* packages/react/src/utils.ts
*/
exports.Explicit = 1;
exports.External = 2;
exports.Static = 4;
// export const Deferred = 8
/**
* Compare two arrays and see if any elements are different (===). Returns true
* by default if either array is undefined
*/
const haveDepsChanged = (prevDeps, nextDeps) => !prevDeps ||
!nextDeps ||
prevDeps.length !== nextDeps.length ||
prevDeps.some((dep, i) => nextDeps[i] !== dep);
exports.haveDepsChanged = haveDepsChanged;
exports.prefix = '@@zedux';