From 748541aaf76ff654b07d77548d9e45cdfe77d5f0 Mon Sep 17 00:00:00 2001 From: Michael Kauzmann Date: Wed, 31 May 2023 16:53:20 -0600 Subject: [PATCH] move isClearingPhetioDynamicElementsProperty to tandem/, https://github.com/phetsims/tandem/issues/294 Signed-off-by: Michael Kauzmann --- js/ReadOnlyProperty.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/js/ReadOnlyProperty.ts b/js/ReadOnlyProperty.ts index fb254f5e..4d956a0a 100644 --- a/js/ReadOnlyProperty.ts +++ b/js/ReadOnlyProperty.ts @@ -26,6 +26,7 @@ import IntentionalAny from '../../phet-core/js/types/IntentionalAny.js'; import StrictOmit from '../../phet-core/js/types/StrictOmit.js'; import axon from './axon.js'; import isSettingPhetioStateProperty from '../../tandem/js/isSettingPhetioStateProperty.js'; +import isClearingPhetioDynamicElementsProperty from '../../tandem/js/isClearingPhetioDynamicElementsProperty.js'; // constants const VALIDATE_OPTIONS_FALSE = { validateValidator: false }; @@ -233,14 +234,10 @@ export default class ReadOnlyProperty extends PhetioObject implements TReadOn */ protected set( value: T ): void { - const simGlobal = _.get( window, 'phet.joist.sim', null ); // returns null if global isn't found - // state is managed by the PhetioStateEngine. // We still want to set Properties when clearing dynamic elements, see https://github.com/phetsims/phet-io/issues/1906 - const setManagedByPhetioState = simGlobal && - isSettingPhetioStateProperty.value && - simGlobal.isClearingPhetioDynamicElementsProperty && - !simGlobal.isClearingPhetioDynamicElementsProperty.value && + const setManagedByPhetioState = isSettingPhetioStateProperty.value && + !isClearingPhetioDynamicElementsProperty.value && this.isPhetioInstrumented() && this.phetioState && // However, DerivedProperty should be able to update during PhET-iO state set