How to use the webcoach.getHarAdvice function in webcoach

To help you get started, we’ve selected a few webcoach examples, based on popular ways it is used in public projects.

github thomasjbradley / markbot / app / checks / performance / task.js View on Github external
ipcRenderer.on('__markbot-hidden-browser-perf-dom-advice-' + ipcListenerLabel, function (event, data) {
      var domAdvice = JSON.parse(data);

      ipcRenderer.removeAllListeners('__markbot-hidden-browser-perf-dom-advice-' + ipcListenerLabel);
      webLoader.destroy(win);
      win = null;

      webcoach.runHarAdvice(webcoach.pickAPage(har, 0), webcoach.getHarAdvice()).then(function (harAdvice) {
        const coachResults = webcoach.merge(domAdvice, harAdvice);
        const coachAdvice = coachResults.advice;
        let errors = [];
        let messages = [];
        let budgetDetails = generateBudgetReport(perf, coachAdvice);

        if (doesPassPerfBudget(perf, coachAdvice)) {
          messages.push(budgetDetails);
        } else {
          errors.push(budgetDetails);
        }

        markbotMain.debug(`Performance score: ${coachAdvice.score}`);

        Object.keys(coachAdvice.performance.adviceList).forEach(function (id) {
          let advice = coachAdvice.performance.adviceList[id];

webcoach

The coach gives you advice on building a better web page

MIT
Latest version published 10 months ago

Package Health Score

62 / 100
Full package analysis

Similar packages