EventSource.hx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\EventSource.webidl. Do not edit!
  23. package js.html;
  24. /**
  25. The `EventSource` interface is web content's interface to server-sent events. An `EventSource` instance opens a persistent connection to an HTTP server, which sends events in `text/event-stream` format.
  26. Documentation [EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/EventSource$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/EventSource>
  28. **/
  29. @:native("EventSource")
  30. extern class EventSource extends EventTarget {
  31. static inline var CONNECTING : Int = 0;
  32. static inline var OPEN : Int = 1;
  33. static inline var CLOSED : Int = 2;
  34. /**
  35. A `DOMString` representing the URL of the source.
  36. **/
  37. var url(default,null) : String;
  38. /**
  39. A `Boolean` indicating whether the `EventSource` object was instantiated with cross-origin (CORS) credentials set (`true`), or not (`false`, the default).
  40. **/
  41. var withCredentials(default,null) : Bool;
  42. /**
  43. A number representing the state of the connection. Possible values are `CONNECTING` (`0`), `OPEN` (`1`), or `CLOSED` (`2`).
  44. **/
  45. var readyState(default,null) : Int;
  46. /**
  47. Is an `EventHandler` called when an `open` event is received, that is when the connection was just opened.
  48. **/
  49. var onopen : haxe.Constraints.Function;
  50. /**
  51. Is an `EventHandler` called when a `message` event is received, that is when a message is coming from the source.
  52. **/
  53. var onmessage : haxe.Constraints.Function;
  54. /**
  55. Is an `EventHandler` called when an error occurs and the `error` event is dispatched on an `EventSource` object.
  56. **/
  57. var onerror : haxe.Constraints.Function;
  58. /** @throws DOMError */
  59. function new( url : String, ?eventSourceInitDict : EventSourceInit ) : Void;
  60. /**
  61. Closes the connection, if any, and sets the `readyState` attribute to `CLOSED`. If the connection is already closed, the method does nothing.
  62. **/
  63. function close() : Void;
  64. }