Show touch bar item (button/group/widget) based on the state of a temporary varible.

I'm just getting started with scripting btt, but as far as I can tell, you can set variables with javascript using set_string_variable and then recall them with get_string_variable. What I want to do is show/hide a touch bar item based on the value of one of these variables, specifically a temporary one, so that the visibility of one touch bar button can be controlled by another touch bar button.