import { Redpitaya } from "https://deno.land/x/pita_api@0.9.1/mod.ts";
Close the Redpitaya connection and triggers disconnect event.
Examples
Example 1
Example 1
redpitaya.addEventListener('disconnect', handleDisconnect)
await redpitaya.pin.digital.led0.write(true) //ok
await redpitaya.close()
//handleDisconnect is called
await redpitaya.pin.digital.led0.write(true) //error
Parameters
- The
cause
parameter is an optional string that describes the reason for closing the Redpitaya. If it is provided, it will be used as the detail for theCustomEvent
that is dispatched to thedisconnect
listeners. If it is not provided, a default detail message will be used.
close() abort all pending messages, no finished state is lost.