Created
October 29, 2018 09:23
-
-
Save kahunacohen/a623d4597f2d60a7ce905d7cc506b93d to your computer and use it in GitHub Desktop.
NCBI-written gatherer for ncbi_app meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const Gatherer = require("lighthouse").Gatherer; | |
/** | |
* @fileoverview Extracts `window.myLoadMetrics` from the test page. | |
*/ | |
class NCBIAppMeta extends Gatherer { | |
async afterPass(options) { | |
const driver = options.driver; | |
const expression = `(function() { | |
var meta = document.querySelector("meta[name=ncbi_app]"); | |
ret = {name: false, content: false}; | |
var content; | |
if (meta) { | |
content = meta.getAttribute("content"); | |
ret.name = true; | |
ret.content = content && content.length > 3; | |
} | |
return ret; | |
})()`; | |
return await driver.evaluateAsync(expression); | |
} | |
} | |
module.exports = NCBIAppMeta; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK I kind of figured. Thanks for taking a look!