Skip to content

Instantly share code, notes, and snippets.

@aerith
Created September 27, 2011 12:47
Show Gist options
  • Save aerith/1244978 to your computer and use it in GitHub Desktop.
Save aerith/1244978 to your computer and use it in GitHub Desktop.
(function (ns, w, d, $) {
var harukaze = ns.harukaze = $.extend({}, ns.harukaze);
var _key_stacks = [];
harukaze.keybind = {
keystack: {
push: function (code) {
_key_stacks.push(code);
},
pop: function () {
_key_stacks.pop();
},
clear: function () {
_key_stacks = [];
},
characters: function () {
var keystack = this;
return $.map(_key_stacks, function () {
return keystack.convert(this);
}).join('');
},
mixed: function () {
return {
characters: this.characters(),
shiftkey: this.shiftkey(),
ctrlkey: this.ctrlkey(),
metakey: this.metakey()
}
}
}
};
})(this, window, document, jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment