{"_id":"tti-polyfill","_rev":"7-e97105ae28adf1b331fc363647aef5d6","name":"tti-polyfill","description":"Polyfill for Time to Interactive. See https://goo.gl/OSmrPk","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"tti-polyfill","version":"0.1.0","description":"Polyfill for Time to Interactive. See https://goo.gl/OSmrPk","main":"tti-polyfill.js","scripts":{"build":"rollup -c -m --format=umd --name=ttiPolyfill --output=tti-polyfill.js"},"repository":{"type":"git","url":"git+https://github.com/GoogleChrome/tti-polyfill.git"},"author":{"name":"Deepanjan Roy","url":"Google"},"contributors":[{"name":"Philip Walton","email":"philip@philipwalton.com","url":"https://philipwalton.com/"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/GoogleChrome/tti-polyfill/issues"},"homepage":"https://github.com/GoogleChrome/tti-polyfill#readme","devDependencies":{"babel-plugin-external-helpers":"^6.22.0","babel-preset-es2015":"^6.24.1","rollup":"^0.41.6","rollup-plugin-babel":"^2.7.1","rollup-plugin-uglify":"^1.0.2"},"gitHead":"ae9ad4c733e68a2c8191b6151ae3bedcff696da0","_id":"tti-polyfill@0.1.0","_shasum":"3930496254c7c97416dbd0c2c1d6e3305d8850c6","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.7.0","_npmUser":{"name":"philipwalton","email":"philip@philipwalton.com"},"dist":{"shasum":"3930496254c7c97416dbd0c2c1d6e3305d8850c6","tarball":"https://registry.npmjs.org/tti-polyfill/-/tti-polyfill-0.1.0.tgz","integrity":"sha512-qb5fBUHj6pInb3t80z0/StkNv3je+vQ6xuL6Y5Hi25XYiS3O1on6mO4Ty4CSg0jhTgU5JbfNrbFc4zwubmcU8w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCqreXdMbE7hoMpcWm6dlCUA4rT2gxI+JVzNO/leAfmTQIgA6EjhctgEA05YKAkEytw4G1dItnafa6In84yJG5SOl4="}]},"maintainers":[{"name":"philipwalton","email":"philip@philipwalton.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/tti-polyfill-0.1.0.tgz_1495138905699_0.920967775862664"}},"0.1.1":{"name":"tti-polyfill","version":"0.1.1","description":"Polyfill for Time to Interactive. See https://goo.gl/OSmrPk","main":"tti-polyfill.js","scripts":{"build":"rollup -c -m --format=umd --name=ttiPolyfill --output=tti-polyfill.js"},"repository":{"type":"git","url":"git+https://github.com/GoogleChrome/tti-polyfill.git"},"author":{"name":"Deepanjan Roy","url":"Google"},"contributors":[{"name":"Philip Walton","email":"philip@philipwalton.com","url":"https://philipwalton.com/"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/GoogleChrome/tti-polyfill/issues"},"homepage":"https://github.com/GoogleChrome/tti-polyfill#readme","devDependencies":{"babel-plugin-external-helpers":"^6.22.0","babel-preset-es2015":"^6.24.1","rollup":"^0.41.6","rollup-plugin-babel":"^2.7.1","rollup-plugin-uglify":"^1.0.2"},"gitHead":"08a2413c21123e45ac148294f42727087e43fa71","_id":"tti-polyfill@0.1.1","_shasum":"4ab6a73f4b6d44e1f11217d115060a8e33e21f83","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.7.0","_npmUser":{"name":"philipwalton","email":"philip@philipwalton.com"},"dist":{"shasum":"4ab6a73f4b6d44e1f11217d115060a8e33e21f83","tarball":"https://registry.npmjs.org/tti-polyfill/-/tti-polyfill-0.1.1.tgz","integrity":"sha512-k1bGs8xfXLlulgAk/wThNnhyBoQ/Y5qfY4idPcrhQX3vfMQNqNORg5j6WussnLUuPFpiOdyxIn6zm8ZLFMe8mA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDniGRorvcj1D7wxcHKBrc3mtobw1gtXQgXknApO1eMXQIhAJ7OfikMbkKOg0wKjms5SFuudzb4tBIdsNDR/nqhUplj"}]},"maintainers":[{"name":"philipwalton","email":"philip@philipwalton.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tti-polyfill-0.1.1.tgz_1495583478370_0.05420922301709652"}},"0.2.0":{"name":"tti-polyfill","version":"0.2.0","description":"Polyfill for Time to Interactive. See https://goo.gl/OSmrPk","main":"tti-polyfill.js","scripts":{"lint":"eslint --fix src/*.js scripts/*.js tests/*.js","build":"npm run lint && node scripts/build.js"},"repository":{"type":"git","url":"git+https://github.com/GoogleChrome/tti-polyfill.git"},"contributors":[{"name":"Deepanjan Roy","url":"Google"},{"name":"Philip Walton","email":"philip@philipwalton.com","url":"https://philipwalton.com/"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/GoogleChrome/tti-polyfill/issues"},"homepage":"https://github.com/GoogleChrome/tti-polyfill#readme","devDependencies":{"chalk":"^1.1.3","eslint":"^4.0.0","eslint-config-google":"^0.8.0","fs-extra":"^3.0.1","google-closure-compiler-js":"^20170521.0.0","gzip-size":"^3.0.0","rollup":"^0.41.6","rollup-plugin-node-resolve":"^3.0.0","source-map":"^0.5.6"},"gitHead":"49d3713fcbfbb8ef1ef5de52f3dfaa42583c06a6","_id":"tti-polyfill@0.2.0","_npmVersion":"5.0.3","_nodeVersion":"8.0.0","_npmUser":{"name":"philipwalton","email":"philip@philipwalton.com"},"dist":{"integrity":"sha512-tCYuuHU4C5JQhqJ/SXPNGJJEquXIZ7pOB2tu5TwU/viCzjH1QLrwgiDU2WojNLK2TGh9VQuEZ3Xwg+u/K9ivTg==","shasum":"3734561af4b33072808254ee1f237ad05cf3f771","tarball":"https://registry.npmjs.org/tti-polyfill/-/tti-polyfill-0.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtQicslFMwdLWe+l+d+KmUuOAVCbz+HRjy1O2ggw2X3AIhAJbeS5AbZb3G4lWBJLT5R1VWevUITf8C81+Tdgaw4Cn0"}]},"maintainers":[{"name":"philipwalton","email":"philip@philipwalton.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tti-polyfill-0.2.0.tgz_1497931432509_0.4348510967101902"}},"0.2.1":{"name":"tti-polyfill","version":"0.2.1","description":"Polyfill for Time to Interactive. See https://goo.gl/OSmrPk","main":"tti-polyfill.js","scripts":{"lint":"eslint --fix src/*.js scripts/*.js tests/*.js","build":"npm run lint && node scripts/build.js"},"repository":{"type":"git","url":"git+https://github.com/GoogleChrome/tti-polyfill.git"},"contributors":[{"name":"Deepanjan Roy","url":"Google"},{"name":"Philip Walton","email":"philip@philipwalton.com","url":"https://philipwalton.com/"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/GoogleChrome/tti-polyfill/issues"},"homepage":"https://github.com/GoogleChrome/tti-polyfill#readme","devDependencies":{"chalk":"^1.1.3","eslint":"^4.0.0","eslint-config-google":"^0.8.0","fs-extra":"^3.0.1","google-closure-compiler-js":"^20170521.0.0","gzip-size":"^3.0.0","rollup":"^0.41.6","rollup-plugin-node-resolve":"^3.0.0","source-map":"^0.5.6"},"gitHead":"2c051bf3c62910140c663d7e42db7fb70448f70b","_id":"tti-polyfill@0.2.1","_npmVersion":"5.0.3","_nodeVersion":"8.0.0","_npmUser":{"name":"philipwalton","email":"philip@philipwalton.com"},"dist":{"integrity":"sha512-VoXUFaL0hkPek17H0vLBrLC+sfYDD4M9jZcf54uSukgh3OWsQXWjX8GRyN8n9DQZ4amu2HXCqFmHDtg14w5kMg==","shasum":"72a3e421feacad404d7a17322a4aaad96baac9f0","tarball":"https://registry.npmjs.org/tti-polyfill/-/tti-polyfill-0.2.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEj9FuxeuxWc4oEzR11MiKKASNp+ktSg0qeDerGEJnA0AiBrT5UChf42nr41nJpP8tcPMtKfuffQQ3nSLPWTIm4r6Q=="}]},"maintainers":[{"name":"philipwalton","email":"philip@philipwalton.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tti-polyfill-0.2.1.tgz_1497985306929_0.5764527341816574"}},"0.2.2":{"name":"tti-polyfill","version":"0.2.2","description":"Polyfill for Time to Interactive. See https://goo.gl/OSmrPk","main":"tti-polyfill.js","scripts":{"lint":"eslint --fix src/*.js scripts/*.js tests/*.js","build":"npm run lint && node scripts/build.js"},"repository":{"type":"git","url":"git+https://github.com/GoogleChrome/tti-polyfill.git"},"contributors":[{"name":"Deepanjan Roy","url":"Google"},{"name":"Philip Walton","email":"philip@philipwalton.com","url":"https://philipwalton.com/"}],"license":"Apache-2.0","bugs":{"url":"https://github.com/GoogleChrome/tti-polyfill/issues"},"homepage":"https://github.com/GoogleChrome/tti-polyfill#readme","devDependencies":{"chalk":"^1.1.3","eslint":"^4.0.0","eslint-config-google":"^0.8.0","fs-extra":"^3.0.1","google-closure-compiler-js":"^20170521.0.0","gzip-size":"^3.0.0","rollup":"^0.41.6","rollup-plugin-node-resolve":"^3.0.0","source-map":"^0.5.6"},"gitHead":"4b5058efb695f2f51aa6f586d9a46dc9c0207f30","_id":"tti-polyfill@0.2.2","_npmVersion":"5.0.3","_nodeVersion":"8.0.0","_npmUser":{"name":"philipwalton","email":"philip@philipwalton.com"},"dist":{"integrity":"sha512-URIoJxvsHThbQEJij29hIBUDHx9UNoBBCQVjy7L8PnzkqY8N6lsAI6h8JrT1Wt2lA0avus/DkuiJxd9qpfCpqw==","shasum":"f7bbf71b13afa9edf60c8bb0d0c05f134e1513b9","tarball":"https://registry.npmjs.org/tti-polyfill/-/tti-polyfill-0.2.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrjHnWgSet2HZuwAekvsdOlduG+JRq0Sw/Ow4jJgp3BgIhAIjIbBu48NPL0FXfPLU4RG0FYP2Nq1sVz+sc2TBx5LS0"}]},"maintainers":[{"name":"philipwalton","email":"philip@philipwalton.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tti-polyfill-0.2.2.tgz_1497993734740_0.9808124017436057"}}},"readme":"Time to Interactive Polyfill\n============================\n\nA polyfill for the Time to Interactive metric. See the [metric definition](https://goo.gl/OSmrPk) for in-depth implementation details.\n\n## Installation\n\nYou can install the TTI polyfill from npm by running:\n\n```sh\nnpm install tti-polyfill\n```\n\n## Usage\n\nAdding the TTI polyfill is a two-step process. First you need to add a snippet of code to the head of your document (before any other scripts run). This snippet creates a `PerformanceObserver` instance and starts observing `longtask` entry types.\n\n```html\n<script>\n!function(){if('PerformanceLongTaskTiming' in window){var g=window.__tti={e:[]};\ng.o=new PerformanceObserver(function(l){g.e=g.e.concat(l.getEntries())});\ng.o.observe({entryTypes:['longtask']})}}();\n</script>\n```\n\n*__Note:__ this snippet is a temporary workaround, until browsers implement level 2 of the Performance Observer spec and include the [`buffered`](https://w3c.github.io/performance-timeline/#dom-performanceobserverinit-buffered) flag.*\n\nThe second step is to import the module into your application code and invoke the `getFirstConsistentlyInteractive()` method. The `getFirstConsistentlyInteractive()` method returns a promise that resolves to the TTI metric value (in milliseconds since navigation start). If no TTI value can be found, or if the browser doesn't support all the APIs required to detect TTI, the promise resolves to `null`.\n\n```js\nimport ttiPolyfill from './path/to/tti-polyfill.js';\n\nttiPolyfill.getFirstConsistentlyInteractive(opts).then((tti) => {\n  // Use `tti` value in some way.\n});\n```\n\nNote that this method can be invoked at any time, it does not need to be called prior to interactivity being reached. This allows you to load the polyfill via `<script async>`, so it doesn't block any other critical resources.\n\n### Configuration options\n\nThe following table outlines the configuration options you can pass to the `getFirstConsistentlyInteractive()` method:\n\n<table>\n  <tr valign=\"top\">\n    <th align=\"left\">Name</th>\n    <th align=\"left\">Type</th>\n    <th align=\"left\">Description</th>\n  </tr>\n  <tr valign=\"top\">\n    <td><code>minValue</code></td>\n    <td><code>number|null</code></td>\n    <td>\n      The lower bound to start forward-searching for the quite window. If no value is set, the default is after the <code>DOMContentLoaded</code> event.\n    </td>\n  </tr>\n  <tr valign=\"top\">\n    <td><code>useMutationObserver</code></td>\n    <td><code>boolean</code></td>\n    <td>\n      When true (the default), a mutation observer is used to detect when added DOM elements will create additional network requests. This can be disabled to improve performance in cases where you know no additional request-creating DOM elements will be added.\n    </td>\n  </tr>\n</table>\n\n### The debug version\n\nA [debug](https://github.com/GoogleChrome/tti-polyfill/blob/master/tti-polyfill-debug.js) version of the polyfill ships with this repo that includes helpful `console.log()` statements that can be used to better understand how the polyfill is working under the hood.\n\n*__Note:__ usage for the debug version is exactly the same as the regular version.*\n\n## Browser support\n\nThe TTI polyfill will work in any browser that supports [`PerformanceObserver`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver) and the [`PerformanceLongTaskTiming`](https://w3c.github.io/longtasks/) entry.\n\nAt the moment this is Chrome 58+.\n","maintainers":[{"name":"philipwalton","email":"philip@philipwalton.com"}],"time":{"modified":"2022-06-27T22:58:17.059Z","created":"2017-05-18T20:21:48.547Z","0.1.0":"2017-05-18T20:21:48.547Z","0.1.1":"2017-05-23T23:51:18.486Z","0.2.0":"2017-06-20T04:03:52.635Z","0.2.1":"2017-06-20T19:01:47.072Z","0.2.2":"2017-06-20T21:22:14.875Z"},"homepage":"https://github.com/GoogleChrome/tti-polyfill#readme","repository":{"type":"git","url":"git+https://github.com/GoogleChrome/tti-polyfill.git"},"contributors":[{"name":"Deepanjan Roy","url":"Google"},{"name":"Philip Walton","email":"philip@philipwalton.com","url":"https://philipwalton.com/"}],"bugs":{"url":"https://github.com/GoogleChrome/tti-polyfill/issues"},"license":"Apache-2.0","readmeFilename":"README.md"}