Add docs.
This commit is contained in:
1 parent
abad357bde
commit
4e9551f777
1 file changed
+10
@@ -7,6 +7,11 @@ class PageSpeedService {
|
|||||||
this.SERVICE_NAME = "PageSpeedService";
|
this.SERVICE_NAME = "PageSpeedService";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs a PageSpeed check using Google Lighthouse API.
|
||||||
|
* @param {string} url - The URL to check.
|
||||||
|
* @returns {Promise<Object>} The results from the PageSpeed API.
|
||||||
|
*/
|
||||||
async runPageSpeedCheck(url) {
|
async runPageSpeedCheck(url) {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(`https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}`);
|
const response = await axios.get(`https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}`);
|
||||||
@@ -20,6 +25,11 @@ class PageSpeedService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new PageSpeedCheck document.
|
||||||
|
* @param {Object} data - The data for the new PageSpeedCheck.
|
||||||
|
* @returns {Promise<PageSpeedCheck>} The created PageSpeedCheck document.
|
||||||
|
*/
|
||||||
async createPageSpeedCheck(data) {
|
async createPageSpeedCheck(data) {
|
||||||
const newPageSpeedCheck = new PageSpeedCheck(data);
|
const newPageSpeedCheck = new PageSpeedCheck(data);
|
||||||
return await newPageSpeedCheck.save();
|
return await newPageSpeedCheck.save();
|
||||||
|
|||||||
Reference in new issue
Block a user