Download pool/shard006/JavaScript/0037603_event-data.any.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 641 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard006/JavaScript/0037603_event-data.any.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard006/JavaScript/0037603_event-data.any.js
-
curl -L -o 0037603_event-data.any.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard006/JavaScript/0037603_event-data.any.js
641 Bytes
| // META: title=EventSource: lines and data parsing | |
| var test = async_test(); | |
| test.step(function() { | |
| var source = new EventSource("resources/message2.py"), | |
| counter = 0; | |
| source.onmessage = test.step_func(function(e) { | |
| if(counter == 0) { | |
| assert_equals(e.data,"msg\nmsg"); | |
| } else if(counter == 1) { | |
| assert_equals(e.data,""); | |
| } else if(counter == 2) { | |
| assert_equals(e.data,"end"); | |
| source.close(); | |
| test.done(); | |
| } else { | |
| assert_unreached(); | |
| } | |
| counter++; | |
| }); | |
| }); | |