format-field-id.any.js (672B)
1 // META: title=EventSource: Last-Event-ID 2 var test = async_test() 3 test.step(function() { 4 var source = new EventSource("resources/last-event-id.py"), 5 seenhello = false 6 source.onmessage = function(e) { 7 test.step(function() { 8 if(e.data == "hello" && !seenhello) { 9 seenhello = true 10 assert_equals(e.lastEventId, "…") 11 } else if(seenhello) { 12 assert_equals("…", e.data) 13 assert_equals("…", e.lastEventId) 14 source.close() 15 test.done() 16 } else 17 assert_unreached() 18 }) 19 } 20 })