Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.34 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.34 KB

meteor-keybindings

A meteor package for awesome key handling / bindings, with some methods to make the stuff easier. It uses the underscore and jquery meteor packages together with the awesome jwerty.js for key bindings.

How to install

mrt add keybindings

Overview

You can easily add, remove and replace keys with Meteor.Keybindings

Meteor.Keybindings.addOne('a', function() { 
	console.log('You pressed a');
});

Meteor.Keybindings.add({
	'alt+a' : function () { console.log('alt+a'); },
	'alt+b' : function () { console.log('alt+b'); },
	'alt+c' : function () { console.log('alt+c'); }
});

Meteor.Keybindings.remove(['alt+a', 'alt+b']);

Meteor.Keybindings.replace('a', function() {
	console.log('You pressed the new a');
});

The keys are bound to the body and the event is keydown if the values are not defined.

Meteor.Keybindings.addOne(key, function, context, event);
Meteor.Keybindings.removeOne(key, context, event);

For more information on how you can specificy the keys, check the jwerty README.

####This is an early build (some stuff not tested)!

There are Qunit tests and yuidoc available for more informations.