import { PureEffect } from '@typed/effects' ; export function createUpdateManager < A extends object > ( getAllDescendants ) { const updated = new WeakMap < A > ( ) ; function * setUpdated ( node , hasBeenUpdated ) { updated . set ( node , hasBeenUpdated ) ; if ( ! hasBeenUpdated ) { for ( const child of getAllDescendants ( node ) ) { updated . set ( child , hasBeenUpdated ) ; } } } function hasBeenUpdated ( node ) { return updated . get ( node ) === true ; } return { setUpdated , hasBeenUpdated , } as const ; }