This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
/
tti-polyfill.js.map
1 lines (1 loc) · 34.8 KB
/
tti-polyfill.js.map
1
{"version":3,"sources":[" [synthetic:util/global] "," [synthetic:util/defineproperty] "," [synthetic:es6/symbol] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterable] "," [synthetic:es6/util/arrayfromiterator] ","src/activityTrackerUtils.js","src/firstConsistentlyInteractiveCore.js","src/firstConsistentlyInteractiveDetector.js","src/umd-wrapper.js","src/index.js"],"names":["$jscomp.global","$jscomp.defineProperty","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.symbolCounter_","$jscomp.SYMBOL_PREFIX","$jscomp.arrayIterator","$jscomp.initSymbolIterator","$jscomp.iteratorPrototype","uniqueId","patchXMLHTTPRequest","beforeXHRSendCb","onRequestCompletedCb","send","XMLHttpRequest","prototype","requestId","XMLHttpRequest.prototype.send","addEventListener","readyState","apply","args","patchFetch","beforeRequestCb","afterRequestCb","originalFetch","fetch","Promise","resolve","reject","$jscomp.arrayFromIterable","then","value","err","requestCreatingNodeNames","subtreeContainsNodeName","nodes","nodeNames","$jscomp.makeIterator","node","includes","nodeName","toLowerCase","children","observeResourceFetchingMutations","callback","mutationObserver","MutationObserver","mutations","mutation","type","addedNodes","target","tagName","observe","document","attributes","childList","subtree","attributeFilter","computeLastKnownNetwork2Busy","incompleteRequestStarts","observedResourceRequests","length","performance","now","endpoints","req","push","timestamp","start","end","ts","sort","a","b","currentActive","i","endpoint","Error","constructor","FirstConsistentlyInteractiveDetector","config","_useMutationObserver","useMutationObserver","_minValue","minValue","snippetEntries","window","__tti","e","snippetObserver","o","_longTasks","map","performanceEntry","startTime","duration","disconnect","_networkRequests","_incompleteJSInitiatedRequestStartTimes","Map","_timerId","_timerActivationTime","Infinity","_scheduleTimerTasks","_mutationObserver","_performanceObserver","_firstConsistentlyInteractiveResolver","activityTrackerUtils.patchXMLHTTPRequest","_registerListeners","_beforeJSInitiatedRequestCallback","bind","_afterJSInitiatedRequestCallback","activityTrackerUtils.patchFetch","_registerPerformanceObserver","activityTrackerUtils.observeResourceFetchingMutations","_mutationObserverCallback","getFirstConsistentlyInteractive","startSchedulingTimerTasks","lastLongTaskEnd","lastKnownNetwork2Busy","firstConsistentlyInteractiveCore.computeLastKnownNetwork2Busy","_incompleteRequestStarts","rescheduleTimer","Math","max","earliestTime","clearTimeout","setTimeout","navigationStart","timing","lastBusy","_checkTTI","searchStart","chrome","firstPaint","loadTimes","firstPaintTime","domContentLoadedEventEnd","currentTime","maybeFCI","longTasks","PerformanceObserver","entryList","getEntries","entries","entry","entryType","_networkRequestFinishedCallback","fetchStart","responseEnd","taskEndTime","_longTaskFinishedCallback","entryTypes","set","delete","$jscomp.global.Object.defineProperties","values","moduleExport","opts","detector","module","exports","define","amd","ttiPolyfill"],"mappings":"A,YA2CA,IAAAA,EAb2B,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAa0B,IAb1B,CAa0B,IAb1B,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CAAmD,MAAnD,CAW6B,IAAnC,CCPAC,EAC4D,UAAxD,EAAsB,MAAO,OAAA,iBAA7B,CACA,MAAA,eADA,CAEA,QAAQ,CAAC,CAAD,CAAS,CAAT,CAAmB,CAAnB,CAA+B,CAOjC,CAAJ,EAAc,KAAA,UAAd,EAAiC,CAAjC,EAA2C,MAAA,UAA3C,GACA,CAAA,CAAO,CAAP,CADA,CACmB,CAAA,MADnB,CAPqC,CCZtB,SAAA,EAAQ,EAAG,CAE9BC,CAAA,CAAqB,QAAQ,EAAG,EAE3BF,EAAA,OAAL,GACEA,CAAA,OADF,CAC6BG,CAD7B,CAJ8B,CAWhC,IAAAC,EAAyB,CASR,SAAA,EAAQ,CAAC,CAAD,CAAkB,CACzC,MA5BsBC,gBA4BtB,EAC6B,CAD7B,EACgD,EADhD,EACuDD,CAAA,EAFd;A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AAD,CAAY,CAG3C,IAAAoF,EAAAuD,IAAA,CACI3I,CADJ,CACegD,WAAAC,IAAA,EADf,CAH2C,CAc7C,EAAA,UAAA,EAAA,CAAAgD,QAAgC,CAACjG,CAAD,CAAY,CAG1C,IAAAoF,EAAAwD,OAAA,CAAoD5I,CAApD,CAH0C,CAgD5C;CAAA,UAAA,EAAA,CAAAqG,QAAyB,EAAiB,CAMxCO,CAAA,CAAAA,IAAA,CAAqB5D,WAAAC,IAAA,EAArB,CAAyC,GAAzC,CANwC,CA/Q5C4F,EAAA,OAAA,iBAAA,CAAA,CAAA,UAAA,CAAA,CAAA,EA6SM,CAAA,aAAA,CAAA,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,IAA2BlC,QAAA,EAAA,CAC7B,MAAO,EAAA,OAAA,CAAA7F,CAAA,CAAI,IAAAsE,EAAA0D,OAAA,EAAJ,CAAA,CADsB,CAA3B,CA7SN,CAAA,CCTA,KAGMC,EAAe,CAACzC,gCCQyBA,QAAA,CAAC0C,CAAD,CAAe,CAAdA,CAAA,CAAAA,CAAA,CAAAA,CAAA,CAAO,EACrD,OAAI,2BAAJ,EAAmCxE,OAAnC,CAES8B,CADU2C,IAAIhF,CAAJgF,CAAyCD,CAAzCC,CACV3C,iCAAA,EAFT,CAIS3F,OAAAC,QAAA,CAAgB,IAAhB,CALmD,CDRzC,CAGA;WAArB,EAAI,MAAOsI,OAAX,EAAoCA,MAAAC,QAApC,CACED,MAAAC,QADF,CACmBJ,CADnB,CAE6B,UAAtB,GAAI,MAAOK,OAAX,EAAoCA,MAAAC,IAApC,CACLD,MAAA,CAAO,aAAP,CAAsB,EAAtB,CAA0B,QAAA,EAAML,CAAAA,MAAAA,EAAAA,CAAhC,CADK,CAGLvE,MAAA8E,YAHK,CAGgBP","file":"","sourcesContent":[null,null,null,null,null,null,"// Copyright 2017 Google Inc. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nlet uniqueId = 0;\n\n\n/**\n * Overrides the native XHR send method in order to keep track of in-flight\n * network requests.\n * @param {!Function} beforeXHRSendCb\n * @param {!Function} onRequestCompletedCb\n */\nexport function patchXMLHTTPRequest(beforeXHRSendCb, onRequestCompletedCb) {\n const send = XMLHttpRequest.prototype.send;\n const requestId = uniqueId++;\n\n XMLHttpRequest.prototype.send = function(...args) { // No arrow function.\n beforeXHRSendCb(requestId);\n this.addEventListener('readystatechange', () => {\n // readyState 4 corresponds to 'DONE'\n if (this.readyState === 4) onRequestCompletedCb(requestId);\n });\n return send.apply(this, args);\n };\n}\n\n\n/**\n * Overrides the native fetch() in order to keep track of in-flight network\n * requests.\n * @param {!Function} beforeRequestCb\n * @param {!Function} afterRequestCb\n */\nexport function patchFetch(beforeRequestCb, afterRequestCb) {\n const originalFetch = fetch;\n\n // TODO(philipwalton): assign this to a property of the global variable\n // explicitely rather than implicitely.\n // eslint-disable-next-line no-global-assign\n fetch = (...args) => {\n return new Promise((resolve, reject) => {\n const requestId = uniqueId++;\n beforeRequestCb(requestId);\n originalFetch(...args).then(\n (value) => {\n afterRequestCb(requestId);\n resolve(value);\n },\n (err) => {\n afterRequestCb(err);\n reject(err);\n });\n });\n };\n}\n\n\n/** @type {!Array<string>} */\nconst requestCreatingNodeNames =\n ['img', 'script', 'iframe', 'link', 'audio', 'video', 'source'];\n\n\n/**\n * Determines if a node or its descendants match one of the passed node names.\n * @param {!Array<!Node>|!NodeList<!Node>} nodes\n * @param {!Array<string>} nodeNames\n * @return {boolean}\n */\nfunction subtreeContainsNodeName(nodes, nodeNames) {\n for (const node of nodes) {\n if (nodeNames.includes(node.nodeName.toLowerCase()) ||\n subtreeContainsNodeName(node.children, nodeNames)) {\n return true;\n }\n }\n return false;\n}\n\n\n/**\n * Start observing DOM mutations for added nodes that may initiate network\n * requests.\n * @param {!Function} callback\n * @return {!MutationObserver}\n */\nexport function observeResourceFetchingMutations(callback) {\n const mutationObserver = new MutationObserver((mutations) => {\n // Typecast to fix: https://github.com/google/closure-compiler/issues/2539\n // eslint-disable-next-line no-self-assign\n mutations = /** @type {!Array<!MutationRecord>} */ (mutations);\n\n for (const mutation of mutations) {\n if (mutation.type == 'childList' &&\n subtreeContainsNodeName(\n mutation.addedNodes, requestCreatingNodeNames)) {\n callback(mutation);\n } else if (mutation.type == 'attributes' &&\n requestCreatingNodeNames.includes(\n mutation.target.tagName.toLowerCase())) {\n callback(mutation);\n }\n }\n });\n\n mutationObserver.observe(document, {\n attributes: true,\n childList: true,\n subtree: true,\n attributeFilter: ['href', 'src'],\n });\n\n return mutationObserver;\n}\n","// Copyright 2017 Google Inc. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n/**\n * Computes the first consistently interactive value...\n * @param {number} searchStart\n * @param {number} minValue\n * @param {number} lastKnownNetwork2Busy\n * @param {number} currentTime\n * @param {!Array<{start: (number), end: (number)}>} longTasks\n * @return {number|null}\n */\nexport const computeFirstConsistentlyInteractive =\n (searchStart, minValue, lastKnownNetwork2Busy, currentTime, longTasks) => {\n // Have not reached network 2-quiet yet.\n if ((currentTime - lastKnownNetwork2Busy) < 5000) return null;\n\n const maybeFCI = longTasks.length === 0 ?\n searchStart : longTasks[longTasks.length - 1].end;\n\n // Main thread has not been quiet for long enough.\n if (currentTime - maybeFCI < 5000) return null;\n\n return Math.max(maybeFCI, minValue);\n};\n\n\n/**\n * Computes the time (in milliseconds since requestStart) that the network was\n * last known to have >2 requests in-flight.\n * @param {!Array<number>} incompleteRequestStarts\n * @param {!Array<{start: (number), end: (number)}>} observedResourceRequests\n * @return {number}\n */\nexport const computeLastKnownNetwork2Busy =\n (incompleteRequestStarts, observedResourceRequests) => {\n if (incompleteRequestStarts.length > 2) return performance.now();\n\n const endpoints = [];\n for (const req of observedResourceRequests) {\n endpoints.push({\n timestamp: req.start,\n type: 'requestStart',\n });\n endpoints.push({\n timestamp: req.end,\n type: 'requestEnd',\n });\n }\n\n for (const ts of incompleteRequestStarts) {\n endpoints.push({\n timestamp: ts,\n type: 'requestStart',\n });\n }\n\n endpoints.sort((a, b) => a.timestamp - b.timestamp);\n\n let currentActive = incompleteRequestStarts.length;\n\n for (let i = endpoints.length - 1; i >= 0; i--) {\n const endpoint = endpoints[i];\n switch (endpoint.type) {\n case 'requestStart':\n currentActive--;\n break;\n case 'requestEnd':\n currentActive++;\n if (currentActive > 2) {\n return endpoint.timestamp;\n }\n break;\n default:\n throw Error('Internal Error: This should never happen');\n }\n }\n\n // If we reach here, we were never network 2-busy.\n return 0;\n};\n","// Copyright 2017 Google Inc. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n/* global PerformanceObserver */\n\n\nimport * as activityTrackerUtils from './activityTrackerUtils.js';\nimport {log} from './debug.js';\nimport * as firstConsistentlyInteractiveCore\n from './firstConsistentlyInteractiveCore.js';\n\n\n/**\n * Class to detect first consistently interactive.\n */\nexport default class FirstConsistentlyInteractiveDetector {\n /**\n * @param {!FirstConsistentlyInteractiveDetectorInit=} config\n */\n constructor(config = {}) {\n this._useMutationObserver = !!config.useMutationObserver;\n\n // If minValue is null, by default it is DOMContentLoadedEnd.\n this._minValue = config.minValue || null;\n\n /** @type {Array<PerformanceEntry>|undefined} */\n const snippetEntries = window.__tti && window.__tti.e;\n\n /** @type {PerformanceObserver|undefined} */\n const snippetObserver = window.__tti && window.__tti.o;\n\n // If we recorded some long tasks before this class was initialized,\n // consume them now.\n if (snippetEntries) {\n log(`Consuming the long task entries already recorded.`);\n\n this._longTasks = snippetEntries.map((performanceEntry) => {\n return {\n start: performanceEntry.startTime,\n end: performanceEntry.startTime + performanceEntry.duration,\n };\n });\n } else {\n this._longTasks = [];\n }\n\n // If we had a long task observer attached by the snippet, disconnect it\n // here. We will be adding a new long task observer soon with a more\n // complex callback.\n if (snippetObserver) {\n snippetObserver.disconnect();\n }\n\n this._networkRequests = [];\n this._incompleteJSInitiatedRequestStartTimes = new Map();\n\n this._timerId = null;\n this._timerActivationTime = -Infinity;\n\n // Timer tasks are only scheduled when detector is enabled.\n this._scheduleTimerTasks = false;\n\n /** @type {?Function} */\n this._firstConsistentlyInteractiveResolver = null;\n\n /** @type {?PerformanceObserver} */\n this._performanceObserver = null;\n\n /** @type {?MutationObserver} */\n this._mutationObserver = null;\n\n this._registerListeners();\n }\n\n /**\n * Starts checking for a first consistently interactive time and returns a\n * promise that resolves to the found time.\n * @return {!Promise<number>}\n */\n getFirstConsistentlyInteractive() {\n return new Promise((resolve, reject) => {\n this._firstConsistentlyInteractiveResolver = resolve;\n\n if (document.readyState == 'complete') {\n this.startSchedulingTimerTasks();\n } else {\n window.addEventListener('load', () => {\n // You can use this to set a custom minimum value.\n // this.setMinValue(20000);\n\n this.startSchedulingTimerTasks();\n });\n }\n });\n }\n\n /**\n * Starts scheduling the timer that checks for network quiescence (a 5-second\n * window of no more than 2 in-flight network requests).\n */\n startSchedulingTimerTasks() {\n log(`Enabling FirstConsistentlyInteractiveDetector`);\n\n this._scheduleTimerTasks = true;\n\n const lastLongTaskEnd = this._longTasks.length > 0 ?\n this._longTasks[this._longTasks.length - 1].end : 0;\n\n const lastKnownNetwork2Busy =\n firstConsistentlyInteractiveCore.computeLastKnownNetwork2Busy(\n this._incompleteRequestStarts, this._networkRequests);\n\n this.rescheduleTimer(\n Math.max(lastKnownNetwork2Busy + 5000, lastLongTaskEnd));\n }\n\n /**\n * Setter for the `_minValue` property.\n * @param {number} minValue\n */\n setMinValue(minValue) {\n this._minValue = minValue;\n }\n\n /**\n * Resets the timer that checks for network quiescence.\n * @param {number} earliestTime A timestamp in ms, and the time is relative\n * to navigationStart.\n */\n rescheduleTimer(earliestTime) {\n // Check if ready to start looking for firstConsistentlyInteractive\n if (!this._scheduleTimerTasks) {\n log(`startSchedulingTimerTasks must be called before ` +\n `calling rescheduleTimer`);\n\n return;\n }\n\n log(`Attempting to reschedule FirstConsistentlyInteractive ` +\n `check to ${earliestTime}`);\n log(`Previous timer activation time: ${this._timerActivationTime}`);\n\n if (this._timerActivationTime > earliestTime) {\n log(`Current activation time is greater than attempted ` +\n `reschedule time. No need to postpone.`);\n\n return;\n }\n clearTimeout(this._timerId);\n this._timerId = setTimeout(() => {\n this._checkTTI();\n }, earliestTime - performance.now());\n this._timerActivationTime = earliestTime;\n\n log(`Rescheduled firstConsistentlyInteractive check at ${earliestTime}`);\n }\n\n /**\n * Removes all timers and event listeners.\n */\n disable() {\n log(`Disabling FirstConsistentlyInteractiveDetector`);\n\n clearTimeout(this._timerId);\n this._scheduleTimerTasks = false;\n this._unregisterListeners();\n }\n\n /**\n * Adds\n */\n _registerPerformanceObserver() {\n this._performanceObserver = new PerformanceObserver((entryList) => {\n const entries = entryList.getEntries();\n for (const entry of entries) {\n if (entry.entryType === 'resource') {\n this._networkRequestFinishedCallback(entry);\n }\n if (entry.entryType === 'longtask') {\n this._longTaskFinishedCallback(entry);\n }\n }\n });\n this._performanceObserver.observe({entryTypes: ['longtask', 'resource']});\n }\n\n /**\n * Registers listeners to detect XHR, fetch, resource timing entries, and\n * DOM mutations to detect long tasks and network quiescence.\n */\n _registerListeners() {\n activityTrackerUtils.patchXMLHTTPRequest(\n this._beforeJSInitiatedRequestCallback.bind(this),\n this._afterJSInitiatedRequestCallback.bind(this));\n\n activityTrackerUtils.patchFetch(\n this._beforeJSInitiatedRequestCallback.bind(this),\n this._afterJSInitiatedRequestCallback.bind(this));\n\n this._registerPerformanceObserver();\n\n if (this._useMutationObserver) {\n this._mutationObserver =\n activityTrackerUtils.observeResourceFetchingMutations(\n this._mutationObserverCallback.bind(this));\n }\n }\n\n /**\n * Removes all added listeners.\n */\n _unregisterListeners() {\n // We will leave the XHR / Fetch objects the way they were,\n // since we cannot guarantee they were not modified further in between.\n // Only unregister performance observers.\n if (this._performanceObserver) this._performanceObserver.disconnect();\n if (this._mutationObserver) this._mutationObserver.disconnect();\n }\n\n /**\n * A callback to be run before any new XHR requests. This adds the request\n * to a map so in-flight requests can be tracked.\n * @param {string} requestId\n */\n _beforeJSInitiatedRequestCallback(requestId) {\n log(`Starting JS initiated request. Request ID: ${requestId}`);\n\n this._incompleteJSInitiatedRequestStartTimes.set(\n requestId, performance.now());\n\n log(`Active XHRs: ${this._incompleteJSInitiatedRequestStartTimes.size}`);\n }\n\n /**\n * A callback to be run once any XHR requests have completed. This removes\n * the request from the in-flight request map.\n * @param {string} requestId\n */\n _afterJSInitiatedRequestCallback(requestId) {\n log(`Completed JS initiated request with request ID: ${requestId}`);\n\n this._incompleteJSInitiatedRequestStartTimes.delete(requestId);\n\n log(`Active XHRs: ${this._incompleteJSInitiatedRequestStartTimes.size}`);\n }\n\n /**\n * A callback to be run once new resource timing entries are observed.\n * This adds the entry to an array and resets the timeout detecting the\n * quiet window.\n * @param {PerformanceEntry} performanceEntry\n */\n _networkRequestFinishedCallback(performanceEntry) {\n log(`Network request finished`, performanceEntry);\n\n this._networkRequests.push({\n start: performanceEntry.fetchStart,\n end: performanceEntry.responseEnd,\n });\n this.rescheduleTimer(\n firstConsistentlyInteractiveCore.computeLastKnownNetwork2Busy(\n this._incompleteRequestStarts, this._networkRequests) + 5000);\n }\n\n /**\n * A callback to be run once new long tasks are observed. This resets the\n * timeout detecting the quiet window.\n * @param {PerformanceEntry} performanceEntry\n */\n _longTaskFinishedCallback(performanceEntry) {\n log(`Long task finished`, performanceEntry);\n\n const taskEndTime = performanceEntry.startTime +\n performanceEntry.duration;\n this._longTasks.push({\n start: performanceEntry.startTime,\n end: taskEndTime,\n });\n this.rescheduleTimer(taskEndTime + 5000);\n }\n\n /**\n * A callback to be run once any DOM elements are added that would initiate\n * a new network request. This resets the timeout detecting the quiet window.\n * @param {!MutationRecord} mutationRecord\n */\n _mutationObserverCallback(mutationRecord) {\n log(`Potentially network resource fetching mutation detected`,\n mutationRecord);\n\n log(`Pushing back FirstConsistentlyInteractive check by 5 seconds.`);\n\n this.rescheduleTimer(performance.now() + 5000);\n }\n\n /**\n * Returns either a manually set min value or the time since\n * domContentLoadedEventEnd and navigationStart. If the\n * domContentLoadedEventEnd data isn't available, `null` is returned.\n * @return {number|null}\n */\n _getMinValue() {\n if (this._minValue) return this._minValue;\n\n if (performance.timing.domContentLoadedEventEnd) {\n const {domContentLoadedEventEnd, navigationStart} = performance.timing;\n return domContentLoadedEventEnd - navigationStart;\n }\n\n return null;\n }\n\n /**\n * Gets a list of all in-flight requests.\n * @return {!Array}\n */\n get _incompleteRequestStarts() {\n return [...this._incompleteJSInitiatedRequestStartTimes.values()];\n }\n\n /**\n * Checks to see if a first consistently interactive time has been found.\n * If one has been found, the promise resolver is invoked with the time. If\n * no time has been found, the timeout detecting the quiet window is reset.\n */\n _checkTTI() {\n log(`Checking if First Consistently Interactive was reached...`);\n\n const navigationStart = performance.timing.navigationStart;\n const lastBusy =\n firstConsistentlyInteractiveCore.computeLastKnownNetwork2Busy(\n this._incompleteRequestStarts, this._networkRequests);\n\n // First paint is not available in non-chrome browsers at the moment.\n const firstPaint = window.chrome && window.chrome.loadTimes ?\n (window.chrome.loadTimes().firstPaintTime * 1000 - navigationStart) : 0;\n\n const searchStart = firstPaint || (\n performance.timing.domContentLoadedEventEnd - navigationStart);\n\n const minValue = this._getMinValue();\n const currentTime = performance.now();\n\n // Ideally we will only start scheduling timers after DOMContentLoaded and\n // this case should never be hit.\n if (minValue === null) {\n log(`No usable minimum value yet. Postponing check.`);\n\n this.rescheduleTimer(Math.max(lastBusy + 5000, currentTime + 1000));\n }\n\n log(`Parameter values:`);\n log(`NavigationStart`, navigationStart);\n log(`lastKnownNetwork2Busy`, lastBusy);\n log(`Search Start`, searchStart);\n log(`Min Value`, minValue);\n log(`Last busy`, lastBusy);\n log(`Current time`, currentTime);\n log(`Long tasks`, this._longTasks);\n log(`Incomplete JS Request Start Times`, this._incompleteRequestStarts);\n log(`Network requests`, this._networkRequests);\n\n const maybeFCI =\n firstConsistentlyInteractiveCore.computeFirstConsistentlyInteractive(\n searchStart, /** @type {number} */ (minValue), lastBusy,\n currentTime, this._longTasks);\n\n if (maybeFCI) {\n this._firstConsistentlyInteractiveResolver(\n /** @type {number} */ (maybeFCI));\n this.disable();\n }\n\n // First Consistently Interactive was not reached for whatever reasons.\n // Check again in one second. Eventually we should become confident enough\n // in our scheduler logic to get rid of this step.\n log(`Could not detect First Consistently Interactive. ` +\n `Retrying in 1 second.`);\n\n this.rescheduleTimer(performance.now() + 1000);\n }\n}\n","// Copyright 2017 Google Inc. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\n/* global define, module */\n\n\nimport {getFirstConsistentlyInteractive} from './index.js';\n\n\nconst moduleExport = {getFirstConsistentlyInteractive};\n\n\nif (typeof module != 'undefined' && module.exports) {\n module.exports = moduleExport;\n} else if (typeof define === 'function' && define.amd) {\n define('ttiPolyfill', [], () => moduleExport);\n} else {\n window.ttiPolyfill = moduleExport;\n}\n","// Copyright 2017 Google Inc. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n\nimport FirstConsistentlyInteractiveDetector\n from './firstConsistentlyInteractiveDetector.js';\n\n\n/**\n * Returns a promise that resolves to the first consistently interactive time\n * (in milliseconds) or null if the browser doesn't support the features\n * required for detection.\n * @param {!FirstConsistentlyInteractiveDetectorInit=} opts Configuration\n * options for the polyfill\n * @return {!Promise} TODO(philipwalton): for some reason the type\n * {!Promise<(number|null)>} isn't working here, check if this is fixed in\n * a new version of closure compiler.\n */\nexport const getFirstConsistentlyInteractive = (opts = {}) => {\n if ('PerformanceLongTaskTiming' in window) {\n const detector = new FirstConsistentlyInteractiveDetector(opts);\n return detector.getFirstConsistentlyInteractive();\n } else {\n return Promise.resolve(null);\n }\n};\n"]}