w3c_navigation_timing.js (6496B)
1 /* 2 * Copyright 2011 The 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 Navigation Timing specification. 19 * 20 * Created from 21 * @see http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html 22 * @see http://w3c-test.org/webperf/specs/ResourceTiming 23 * @see http://www.w3.org/TR/performance-timeline 24 * 25 * @externs 26 */ 27 28 /** @constructor */ 29 function PerformanceTiming() {} 30 /** @type {number} */ PerformanceTiming.prototype.navigationStart; 31 /** @type {number} */ PerformanceTiming.prototype.unloadEventStart; 32 /** @type {number} */ PerformanceTiming.prototype.unloadEventEnd; 33 /** @type {number} */ PerformanceTiming.prototype.redirectStart; 34 /** @type {number} */ PerformanceTiming.prototype.redirectEnd; 35 /** @type {number} */ PerformanceTiming.prototype.fetchStart; 36 /** @type {number} */ PerformanceTiming.prototype.domainLookupStart; 37 /** @type {number} */ PerformanceTiming.prototype.domainLookupEnd; 38 /** @type {number} */ PerformanceTiming.prototype.connectStart; 39 /** @type {number} */ PerformanceTiming.prototype.connectEnd; 40 /** @type {number} */ PerformanceTiming.prototype.secureConnectionStart; 41 /** @type {number} */ PerformanceTiming.prototype.requestStart; 42 /** @type {number} */ PerformanceTiming.prototype.responseStart; 43 /** @type {number} */ PerformanceTiming.prototype.responseEnd; 44 /** @type {number} */ PerformanceTiming.prototype.domLoading; 45 /** @type {number} */ PerformanceTiming.prototype.domInteractive; 46 /** @type {number} */ PerformanceTiming.prototype.domContentLoadedEventStart; 47 /** @type {number} */ PerformanceTiming.prototype.domContentLoadedEventEnd; 48 /** @type {number} */ PerformanceTiming.prototype.domComplete; 49 /** @type {number} */ PerformanceTiming.prototype.loadEventStart; 50 /** @type {number} */ PerformanceTiming.prototype.loadEventEnd; 51 52 /** @constructor */ 53 function PerformanceEntry() {} 54 /** @type {string} */ PerformanceEntry.prototype.name; 55 /** @type {string} */ PerformanceEntry.prototype.entryType; 56 /** @type {number} */ PerformanceEntry.prototype.startTime; 57 /** @type {number} */ PerformanceEntry.prototype.duration; 58 59 /** 60 * @constructor 61 * @extends {PerformanceEntry} 62 */ 63 function PerformanceResourceTiming() {} 64 /** @type {number} */ PerformanceResourceTiming.prototype.redirectStart; 65 /** @type {number} */ PerformanceResourceTiming.prototype.redirectEnd; 66 /** @type {number} */ PerformanceResourceTiming.prototype.fetchStart; 67 /** @type {number} */ PerformanceResourceTiming.prototype.domainLookupStart; 68 /** @type {number} */ PerformanceResourceTiming.prototype.domainLookupEnd; 69 /** @type {number} */ PerformanceResourceTiming.prototype.connectStart; 70 /** @type {number} */ PerformanceResourceTiming.prototype.connectEnd; 71 /** @type {number} */ 72 PerformanceResourceTiming.prototype.secureConnectionStart; 73 /** @type {number} */ PerformanceResourceTiming.prototype.requestStart; 74 /** @type {number} */ PerformanceResourceTiming.prototype.responseStart; 75 /** @type {number} */ PerformanceResourceTiming.prototype.responseEnd; 76 /** @type {string} */ PerformanceResourceTiming.prototype.initiatorType; 77 78 /** @constructor */ 79 function PerformanceNavigation() {} 80 /** @type {number} */ PerformanceNavigation.prototype.TYPE_NAVIGATE = 0; 81 /** @type {number} */ PerformanceNavigation.prototype.TYPE_RELOAD = 1; 82 /** @type {number} */ PerformanceNavigation.prototype.TYPE_BACK_FORWARD = 2; 83 /** @type {number} */ PerformanceNavigation.prototype.TYPE_RESERVED = 255; 84 /** @type {number} */ PerformanceNavigation.prototype.type; 85 /** @type {number} */ PerformanceNavigation.prototype.redirectCount; 86 87 // Only available in WebKit, and only with the --enable-memory-info flag. 88 /** @constructor */ 89 function PerformanceMemory() {} 90 /** @type {number} */ PerformanceMemory.prototype.jsHeapSizeLimit; 91 /** @type {number} */ PerformanceMemory.prototype.totalJSHeapSize; 92 /** @type {number} */ PerformanceMemory.prototype.usedJSHeapSize; 93 94 /** @constructor */ 95 function Performance() {} 96 /** @type {PerformanceTiming} */ Performance.prototype.timing; 97 /** @type {PerformanceNavigation} */ Performance.prototype.navigation; 98 99 /** 100 * Clears the buffer used to store the current list of 101 * PerformanceResourceTiming resources. 102 * @return {undefined} 103 */ 104 Performance.prototype.clearResourceTimings = function() {}; 105 106 /** 107 * Clear out the buffer of performance timing events for webkit browsers. 108 * @return {undefined} 109 */ 110 Performance.prototype.webkitClearResourceTimings = function() {}; 111 112 /** 113 * Set the maximum number of PerformanceResourceTiming resources that may be 114 * stored in the buffer. 115 * @param {number} maxSize 116 */ 117 Performance.prototype.setResourceTimingBufferSize = function(maxSize) {}; 118 119 /** 120 * @return {Array.<PerformanceEntry>} A copy of the PerformanceEntry list, 121 * in chronological order with respect to startTime. 122 * @nosideeffects 123 */ 124 Performance.prototype.getEntries = function() {}; 125 126 /** 127 * @param {string} entryType Only return {@code PerformanceEntry}s with this 128 * entryType. 129 * @return {Array.<PerformanceEntry>} A copy of the PerformanceEntry list, 130 * in chronological order with respect to startTime. 131 * @nosideeffects 132 */ 133 Performance.prototype.getEntriesByType = function(entryType) {}; 134 135 /** 136 * @param {string} name Only return {@code PerformanceEntry}s with this name. 137 * @param {string=} opt_entryType Only return {@code PerformanceEntry}s with 138 * this entryType. 139 * @return {Array.<PerformanceEntry>} PerformanceEntry list in chronological 140 * order with respect to startTime. 141 * @nosideeffects 142 */ 143 Performance.prototype.getEntriesByName = function(name, opt_entryType) {}; 144 145 // Only available in WebKit, and only with the --enable-memory-info flag. 146 /** @type {PerformanceMemory} */ Performance.prototype.memory; 147 148 /** 149 * @return {number} 150 * @nosideeffects 151 */ 152 Performance.prototype.now = function() {}; 153 154 /** 155 * @return {number} 156 * @nosideeffects 157 */ 158 Performance.prototype.webkitNow = function() {}; 159 160 /** @type {Performance} */ 161 Window.prototype.performance;