Accessing Glyph properties in CustomJS

From Python I can add glyphs to a plot like this:

p.text(x=‘transaction_date’, y=‘Value’, text=‘Value’, y_offset=-5, text_font_size=‘10pt’, name=‘text_glyph’, source=source)


and then later access and update its properties (e.g. to hide it) like this:‘text_glyph’)[0].glyph.visible = False


Does anyone know if it is possible to achieve the same as the above line but in a CustomJS snippet so that one can toggle visibility (or color etc.) of glyphs using a callback on a widget.