1Elm.Native.WebSocket = {};
2Elm.Native.WebSocket.make = function(elm) {
4 elm.Native = elm.Native || {};
5 elm.Native.WebSocket = elm.Native.WebSocket || {};
6 if (elm.Native.WebSocket.values) return elm.Native.WebSocket.values;
8 var Signal = Elm.Signal.make(elm);
9 var List = Elm.Native.List.make(elm);
11 function open(url, outgoing) {
12 var incoming = Signal.constant("");
13 var ws = new WebSocket(url);
18 ws.onopen = function(e) {
19 var len = pending.length;
20 for (var i = 0; i < len; ++i) { ws.send(pending[i]); }
23 ws.onmessage = function(event) {
24 elm.notify(incoming.id, event.data);
28 ready ? ws.send(msg) : pending.push(msg);
31 function take1(x,y) { return x }
32 return A3(Signal.lift2, F2(take1), incoming, A2(Signal.lift, send, outgoing));
35 return elm.Native.WebSocket.values = { connect: F2(open) };
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