• Sat 2017.07.22

    Welcome @user79576 I'm glad you have found enjoyment with the Espruino interpreter.

    Although I haven't tried out a fix to your particular issue, I believe the solution is to place the removeListener() function outside your creation of function f() as shown in the online reference:

    http://www.espruino.com/Reference#l_Obje­ct_removeListener

    As the var f is assigned the object result of the function creation, 'connected1' is output as expected, then function f() is created again, 'connected2' is output as expected then the object f() is removed. My guess is that processing is halting at this step as memory is corrupt, and the rest of the statements are ignored as you are seeing.

    Also, try:

    wifi.removeListener("connected",f);
    

    Other detail
    http://www.espruino.com/Reference#Wifi
    http://www.espruino.com/Reference#l_Wifi­_connected

About

Avatar for Robin @Robin started