diff --git a/js/Tandem.js b/js/Tandem.js index 0206b8a6..d22dabb4 100644 --- a/js/Tandem.js +++ b/js/Tandem.js @@ -164,6 +164,16 @@ class Tandem { } } + /** + * Returns true if this Tandem has the specified ancestor Tandem. + * @param ancestor + * @returns {boolean} + * @public + */ + hasAncestor( ancestor ) { + return this.parentTandem === ancestor || ( this.parentTandem && this.parentTandem.hasAncestor( ancestor ) ); + } + /** * Removes a PhetioObject and signifies to listeners that it has been removed. * @param {PhetioObject} phetioObject