Explorar el Código

add convenience function to create listeners.

Lucas Stadler %!s(int64=11) %!d(string=hace) años
padre
commit
c452ef5918
Se han modificado 1 ficheros con 9 adiciones y 0 borrados
  1. 9 0
      js/babl/public/index.html

+ 9 - 0
js/babl/public/index.html

@ -176,6 +176,15 @@
176 176
				}
177 177
				xhr.send();
178 178
			}
179
180
			function makeListener(fn) {
181
				return function(ev) {
182
					var msg = JSON.parse(ev.data);
183
					if (msg.type == "message") {
184
						fn(msg);
185
					}
186
				}
187
			}
179 188
		</script>
180 189
	</body>
181 190
</html>