Generally, every method of the JavaScript bindings can take two optional
parameters, returnCallback and errorCallback. These are two user
defined callback functions. The returnCallback function is called with the
results as arguments, if the method returns its results asynchronously. The
errorCallback is called with an error code in case of an error. The error
code can be one of the following values:

Configures a monoflop of the pins specified by the first parameter as 4 bit
long bitmask. The specified pins must be configured for output. Non-output
pins will be ignored.

The second parameter is a bitmask with the desired value of the specified
output pins. A 1 in the bitmask means high and a 0 in the bitmask means low.

The third parameter indicates the time (in ms) that the pins should hold
the value.

If this function is called with the parameters (9, 1, 1500) or
(0b1001, 0b0001, 1500): Pin 0 will get high and pin 3 will get low. In 1.5s pin
0 will get low and pin 3 will get high again.

A monoflop can be used as a fail-safe mechanism. For example: Lets assume you
have a RS485 bus and an IO-4 Bricklet connected to one of the slave
stacks. You can now call this function every second, with a time parameter
of two seconds and pin 0 set to high. Pin 0 will be high all the time. If now
the RS485 connection is lost, then pin 0 will get low in at most two seconds.

Returns the version of the API definition (major, minor, revision) implemented
by this API bindings. This is neither the release version of this API bindings
nor does it tell you anything about the represented Brick or Bricklet.

Returns the response expected flag for the function specified by the function
ID parameter. It is true if the function is expected to send a response,
false otherwise.

For getter functions this is enabled by default and cannot be disabled,
because those functions will always send a response. For callback configuration
functions it is enabled by default too, but can be disabled by
setResponseExpected(). For setter functions it is disabled by default
and can be enabled.

Enabling the response expected flag for a setter function allows to detect
timeouts and other error conditions calls of this setter as well. The
device will then send a response for this purpose. If this flag is disabled for
a setter function then no response is send and errors are silently ignored,
because they cannot be detected.

Changes the response expected flag of the function specified by the
function ID parameter. This flag can only be changed for setter (default value:
false) and callback configuration functions (default value: true). For
getter functions it is always enabled.

Enabling the response expected flag for a setter function allows to detect
timeouts and other error conditions calls of this setter as well. The
device will then send a response for this purpose. If this flag is disabled for
a setter function then no response is send and errors are silently ignored,
because they cannot be detected.

Callbacks can be registered to receive
time critical or recurring data from the device. The registration is done
with the on() function of
the device object. The first parameter is the callback ID and the second
parameter the callback function: