| 1 | /* |
| 2 | * Copyright 2012 Closure Compiler Authors |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /** |
| 18 | * @fileoverview Definitions for W3C's EventSource API. |
| 19 | * @see http://www.w3.org/TR/eventsource/ |
| 20 | * |
| 21 | * @externs |
| 22 | */ |
| 23 | |
| 24 | /** |
| 25 | * @constructor |
| 26 | * @implements {EventTarget} |
| 27 | * @param {string} url |
| 28 | * @param {Object=} opt_eventSourceInitDict |
| 29 | */ |
| 30 | function EventSource(url, opt_eventSourceInitDict) {} |
| 31 | |
| 32 | /** @override */ |
| 33 | EventSource.prototype.addEventListener = function( |
| 34 | type, listener, useCapture) {}; |
| 35 | |
| 36 | /** @override */ |
| 37 | EventSource.prototype.removeEventListener = function( |
| 38 | type, listener, useCapture) {}; |
| 39 | |
| 40 | /** @override */ |
| 41 | EventSource.prototype.dispatchEvent = function(evt) {}; |
| 42 | |
| 43 | /** |
| 44 | * @type {string} |
| 45 | * @const |
| 46 | */ |
| 47 | EventSource.prototype.url; |
| 48 | |
| 49 | /** @type {boolean} */ |
| 50 | EventSource.prototype.withCredentials; |
| 51 | |
| 52 | /** |
| 53 | * @type {number} |
| 54 | * @const |
| 55 | */ |
| 56 | EventSource.prototype.CONNECTING = 0; |
| 57 | |
| 58 | /** |
| 59 | * @type {number} |
| 60 | * @const |
| 61 | */ |
| 62 | EventSource.prototype.OPEN = 1; |
| 63 | |
| 64 | /** |
| 65 | * @type {number} |
| 66 | * @const |
| 67 | */ |
| 68 | EventSource.prototype.CLOSED = 2; |
| 69 | |
| 70 | /** |
| 71 | * @type {number} |
| 72 | * @const |
| 73 | */ |
| 74 | EventSource.prototype.readyState; |
| 75 | |
| 76 | /** @type {?function(!Event)} */ |
| 77 | EventSource.prototype.onopen = function(e) {}; |
| 78 | |
| 79 | /** @type {?function(!MessageEvent)} */ |
| 80 | EventSource.prototype.onmessage = function(e) {}; |
| 81 | |
| 82 | /** @type {?function(!Event)} */ |
| 83 | EventSource.prototype.onerror = function(e) {}; |
| 84 | |
| 85 | /** @type {function()} */ |
| 86 | EventSource.prototype.close = function() {}; |