litejs

@version  0.0.4
@date     2014-05-16

THIS IS NO LONGER MAINTAINED AND WILL BE DELETED IN THE NEAR FUTURE, USE browser-event-lite INSTEAD

Browser Keymap

Keyboard shortcuts. Download compressed (889 bytes, 599 bytes gzipped) or uncompressed source.

Usage

var keyMap = {
    H: function(event, key) {
        // metacode
        View("help").open()

        // attach subview keymap
        Event.setKeyMap(subViewKeyMap)
    },
    num: function(event, num) {
        alert("number "+num+" pressed")
    }
}
var subViewKeyMap = {
    // override H key - help is already open
    H: function(){},
    esc: function() {
        // metacode
        View("help").close()

        // remove subview keymap
        Event.rmKeyMap(subViewKeyMap)
    },
    // Keypresses are bubbled up to previous view
    bubble: true
}

// attach default keymap
Event.setKeyMap(keyMap)

Licence

Copyright (c) 2012 Lauri Rooden <[email protected]>
The MIT License

Fork me on GitHub

Since 2013 to 2015