13 this.insert = function(key,value) {
15 this.values.push(value);
17 this.lookup = function(key) {
18 var i = this.keys.indexOf(key)
19 return i >= 0 ? this.values[i] : {x:0,y:0,t:0};
21 this.remove = function(key) {
22 var i = this.keys.indexOf(key);
24 var t = this.values[i];
25 this.keys.splice(i,1);
26 this.values.splice(i,1);
31 var root = Elm.Signal.constant([]),
38 var r = dict.lookup(t.identifier);
50 dict.insert(e.identifier,{x:e.pageX,y:e.pageY,t:Date.now()});
53 var t = dict.remove(e.identifier);
54 if (Date.now() - t.t < tapTime) {
56 tap = {_:{}, x:t.x, y:t.y};
60 function listen(name, f) {
62 for (var i = e.changedTouches.length; i--; ) { f(e.changedTouches[i]); }
63 var ts = new Array(e.touches.length);
64 for (var i = e.touches.length; i--; ) { ts[i] = touch(e.touches[i]); }
65 var hasListener = Dispatcher.notify(root.id, ts);
66 if (!hasListener) return document.removeEventListener(name, update);
69 Value.addListener(document, name, update);
72 listen("touchstart", start);
73 listen("touchmove", function(_){});
74 listen("touchend", end);
75 listen("touchcancel", end);
76 listen("touchleave", end);
78 function dependency(f) {
79 var sig = Elm.Signal.lift(f)(root);
80 root.defaultNumberOfKids += 1;
81 sig.defaultNumberOfKids = 0;
85 var touches = dependency(function(ts) {
86 return Elm.JavaScript.castJSArrayToList(ts);
89 var taps = function() {
90 var sig = dependency(function(_) { return tap; });
91 sig.defaultNumberOfKids = 1;
92 function pred(_) { var b = hasTap; hasTap = false; return b; }
93 var sig2 = Elm.Signal.keepIf(pred)({_:{},x:0,y:0})(sig);
94 sig2.defaultNumberOfKids = 0;
98 Elm.Native.Touch = { touches: touches, taps: taps };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list