-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyboard.js
59 lines (58 loc) · 1.47 KB
/
keyboard.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
module.exports = {
name: "keyboard",
ns: "dom",
description: "Gives the keyboard a first class identity, normalizes keyboard events across browsers, and allows binding to multiple keys.",
phrases: {
active: "Handling keyboard"
},
ports: {
input: {
element: {
type: "HTMLElement",
title: "Dom Element"
},
"in": {
type: "string",
title: "Key(s)",
description: "a string that can be any key name or a combination of key names separated by '+' or '->'. The '+' combinator requires the keys be held together, '->' requires they be pressed in a specific sequence."
},
filter: {
type: "string",
"enum": ["activate",
"release",
"repeat",
"press"
],
title: "Filter",
"default": null
}
},
output: {
element: {
type: "HTMLElement",
title: "Dom Element"
},
out: {
type: "any",
title: "Keyboard event(s)"
}
}
},
dependencies: {
npm: {
keyboard: require('keyboard')
}
},
fn: function keyboard(input, $, output, state, done, cb, on, keyboard) {
var r = function() {
var kb = new keyboard($.element)
// todo: should be async.keyboard( 'on', $.in, $.filter, function keyboardCallback(element,out) {cb({element: element, out: out});});
}.call(this);
return {
output: output,
state: state,
on: on,
return: r
};
}
}