• Hi,

    Been playing around with the Web Javascript API and have noticed that if you don't specify a callback on some functions the Puck will disconnect instantly. For example:

    Here is what I want to do

    let connection;
    Puck.connect(conn => {
        conn.write('LED1.set();\n');
        connection = conn;
    });
    
    // Use this function later when a button is clicked
    const resetLEDOnButtonClick = () => {
        connection.write('LED1.reset();\n')
    }
    

    Expect when I call the resetLEDOnButtonClick a while later the Puck has been disconnected.

    I've ended up having to pass empty callbacks everywhere just to stop it disconnecting. For example:

    let connection;
    Puck.connect(conn => {
        conn.write('LED1.set();\n', () => {});
        connection = conn;
    });
    
    // Use this function later when a button is clicked
    const resetLEDOnButtonClick = () => {
        connection.write('LED1.reset();\n', () => {})
    }
    

    Is this expected or am I using the API wrong?

About

Avatar for alexjfno1 @alexjfno1 started