object.or(arg) - executes if the previous operation on the object failed.
If arg is function, it will execute in the current object's context, otherwise, it will be printed via the console.log.
object.and(arg) - executes when the object is ready.
If arg is function, it will execute in the current object's context, otherwise, it will be printed via the console.log.
engine = JZZ().or('Cannot start MIDI engine!').and('MIDI engine is ready!');
object.wait(delay) - returns a "delayed reference" of the object.
delay is the timeout in microseconds.
Both code snippets below do the same timing:
port.wait(100).send(0x90,60,127) .wait(100).send(0x90,64,127) .wait(100).send(0x90,67,127); port.wait(100).send(0x90,60,127); port.wait(200).send(0x90,64,127); port.wait(300).send(0x90,67,127);
object.err() - returns the object's error log.
JZZ().openMidiOut('MyMidiOut') .or(function(){ alert('Cannot open MyMidiOut!\n' + this.err()); }) ...