Extracting the state of a toggle in JavaScript

Mar 5, 2010 at 2:11pm

Extracting the state of a toggle in JavaScript

Is there a message that can be sent to a Javascript-created toggle to learn its current state (which may have been altered by the user)?


Mar 5, 2010 at 3:29pm

Assuming that you have a toggle somewhere in the patcher named “yoyo”. You can use the pattr system to get it’s value using getvalueof.

function bang()
var toggle = this.patcher.getnamed("yoyo");
outlet(0, toggle.getvalueof());

Mar 5, 2010 at 5:22pm

Outstanding. Thanks EJ!

Jul 26, 2011 at 3:11am

the javascript documentation could be extended / improved a little bit more..

lets see what version 6 will bring to us!

any references / articles in this matter are always welcome!

happy patching guys!

Jul 26, 2011 at 3:12am

duplicated, sorry

Aug 1, 2011 at 2:48am

super cool, that was the little and important piece i was needing for my javascript toggle sequencer, i should post sources very soon ( :

tks guys!

Aug 1, 2011 at 2:53am

the current version is attached.

yet super simple, build a grid of toggles than outputs bang when the playhead passes by a toggle set to ON.

need to improve it a bit to be really useful, but the main concept and code is pretty much there.

any feedbacks, suggestions, improvements, are more than welcome.


  1. trigercreator.zip

You must be logged in to reply to this topic.