The unbinding of the hotkeys.unbind method is invalid.

Author: xiaoxiaohuayuCreated Nov 22, 2024Updated Nov 22, 2024

This is Demo.I don't understand why the unbinding failed.

let mark = false
    const kVeh = ['1','2','3','4']
    kVeh.forEach((v)=>{
        hotkeys(v,(event, handler)=>{
            console.log('handler.key',handler.key)
            mark = true
        })
    })
    setInterval(()=>{
        console.log('mark',mark)
        if(mark){
            /* good **/
            // hotkeys.unbind()
            /* bad **/
            hotkeys.unbind('1', (event, handler) => {
                console.log('unbind 1 key', handler.key)
                return false
            })
        }
    },1000)