• I guess you could hijack the setGPSPower function:

    Bangle.setGPSPower=((gps)=>((on,app)=>{
        const old = Bangle.isGPSOn();
        gps.apply(Bangle, arguments);
        const now = Bangle.isGPSOn();
        if (old!==now) Bangle.emit('power', 'GPS', now, app);
    }))(Bangle.setGPSPower)
    
    Bangle.on('power', (what, on, app) => console.log(`${what} turned ${on ? 'on' : 'off'} ${app ? 'by '+app : ''}`));
    

    Edit: but yes, built-in events would be nice.

  • @rigrig I don't intend to do anything like that anytime soon, BUT I really liked the concept here, thanks for the idea in general.

About

Avatar for rigrig @rigrig started