EventSource.idl 781 B

123456789101112131415161718192021222324252627
  1. #import <DOM/EventHandler.idl>
  2. #import <DOM/EventTarget.idl>
  3. // https://html.spec.whatwg.org/multipage/server-sent-events.html#eventsource
  4. [Exposed=(Window,Worker)]
  5. interface EventSource : EventTarget {
  6. constructor(USVString url, optional EventSourceInit eventSourceInitDict = {});
  7. readonly attribute USVString url;
  8. readonly attribute boolean withCredentials;
  9. // ready state
  10. const unsigned short CONNECTING = 0;
  11. const unsigned short OPEN = 1;
  12. const unsigned short CLOSED = 2;
  13. readonly attribute unsigned short readyState;
  14. // networking
  15. attribute EventHandler onopen;
  16. attribute EventHandler onmessage;
  17. attribute EventHandler onerror;
  18. undefined close();
  19. };
  20. dictionary EventSourceInit {
  21. boolean withCredentials = false;
  22. };