« get me outta code hell

composite: 'thisProperty' self-reflection - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/cacheable-object.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-04 20:16:39 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-05-01 07:06:05 -0300
commitd8ac315809796da6988211fa2887c599a312bee3 (patch)
tree95d10b4aeb1b76598e29bf0d194e0828cf260065 /src/data/cacheable-object.js
parented480d6b4dc489fa26f673d820f7f8bdd999c828 (diff)
composite: 'thisProperty' self-reflection
Diffstat (limited to 'src/data/cacheable-object.js')
-rw-r--r--src/data/cacheable-object.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/data/cacheable-object.js b/src/data/cacheable-object.js
index addc225b..5e26c5f2 100644
--- a/src/data/cacheable-object.js
+++ b/src/data/cacheable-object.js
@@ -255,7 +255,8 @@ export default class CacheableObject {
 
     if (expose.dependencies?.length > 0) {
       const dependencyKeys = expose.dependencies.slice();
-      const shouldReflect = dependencyKeys.includes('this');
+      const shouldReflectObject = dependencyKeys.includes('this');
+      const shouldReflectProperty = dependencyKeys.includes('thisProperty');
 
       getAllDependencies = () => {
         const dependencies = Object.create(null);
@@ -264,10 +265,14 @@ export default class CacheableObject {
           dependencies[key] = this.#propertyUpdateValues[key];
         }
 
-        if (shouldReflect) {
+        if (shouldReflectObject) {
           dependencies.this = this;
         }
 
+        if (shouldReflectProperty) {
+          dependencies.thisProperty = property;
+        }
+
         return dependencies;
       };
     } else {