On Friday, May 29, 2020 at 3:55:52 AM UTC+2, Roel Vanhout wrote:
>
> Thanks, that's been useful. I had a wrong mental model of how macro 
> storage worked which made me look in the wrong places. In case anyone ever 
> happens to find this while doing the same in the future, I ended up writing 
> this function (to be called from a widget's member function):
>
> function getVariables(widget)
> {
>     var node = widget;
>     var result = [];
>     while (node) {
>         if ($tw.utils.hop(node, "variables") ) {
>             result = 
> result.concat(Object.getOwnPropertyNames(node.variables));
>         }
>         node = node.parentWidget;
>     }
>     return result;
> }
>

That's OK, if you need it that way. .. But accessing variables, that are 
_not_ "own properties", should use the JavaScript prototype chain. So you 
should be able to directly access a given variable, if you want to. This 
should give you much faster access.

-m

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/72c84bda-3436-4d38-8e30-389dc6688419%40googlegroups.com.

Reply via email to