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 JS = Elm.JavaScript.make(elm);
10 var List = Elm.Native.List.make(elm);
12 function open(url, outgoing) {
13 var incoming = Signal.constant(List.Nil);
14 var ws = new WebSocket(JS.fromString(url));
19 ws.onopen = function(e) {
20 var len = pending.length;
21 for (var i = 0; i < len; ++i) { ws.send(pending[i]); }
24 ws.onmessage = function(event) {
25 elm.notify(incoming.id, JS.toString(event.data));
29 var s = JS.fromString(msg);
30 ready ? ws.send(s) : pending.push(s);
33 function take1(x,y) { return x }
34 return A3(Signal.lift2, F2(take1), incoming, A2(Signal.lift, send, outgoing));
37 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