clinical:keybindings

v1.3.3Published 6 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

clinical:keybindings

Keybindings dialogs for the ClinicalFramework apps.

========================================

Installation

meteor add clinical:keybindings

========================================

Usage

1{{> keybindingsModal }}

======================================== ####Javascript Key Codes
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
http://www.webonweboff.com/tips/js/event_key_codes.aspx

======================================== ####ASCII & Unicode Character Tables

http://www.ascii.cl/htmlcodes.htm http://unicode-table.com/en/#control-character

======================================== ####Submitting Data in Forms

Here's a common pattern for submitting data to your app, instead of binding to the submit event. Basically, we're binding to the keyup event instead, looking for keycode 13, and if we detect it, setting a reactive Session variable. This is a preferred Meteor-centric approach to submitting data in forms because it uses minimongo, and gets all the benefits of client-side caching and cursors, such as latency compensation and reactive template updates.

1Template.navbarHeaderTemplate.events({
2  'keyup #urlAddressBar': function(event,template){
3     // keyCode 13 is the 'Enter' key 
4     if(event.keyCode == 13) {
5       // decide whether you want to prevent default behavior or not
6       event.preventDefault()
7       
8       // set client side session variable
9       Session.set('browser_window_location', $('#urlAddressBar').val());
10       
11       // or set something in the database
12       Meteor.users().update({_id: Meteor.userId()}, {$set: { 'profile.selectedUrl': $('#urlAddressBar').val() }})
13       
14       // and finally, maybe force the UI to redraw if necessary
15       Meteor.flush();
16     }
17  }
18});

========================================

Licensing

MIT License