Add a progress bar on the UI

This commit is contained in:
Gaël Métais
2021-01-03 01:43:46 +00:00
parent 64733d55f8
commit bd9cb2e257
10 changed files with 122 additions and 10 deletions
+36 -1
View File
@@ -24,7 +24,29 @@ var Runner = function(params) {
// Execute Phantomas first
phantomasWrapper.execute(data)
// For the progress bar
.progress(function(event) {
if (event === 'domReady') {
deferred.notify({
estimatedProgress: 0.15,
milestone: 'domReady'
});
}
if (event === 'domComplete') {
deferred.notify({
estimatedProgress: 0.25,
milestone: 'domComplete'
});
}
})
.then(function(phantomasResults) {
// For the progress bar
deferred.notify({
estimatedProgress: 0.4,
milestone: 'phantomas'
});
data.toolsResults.phantomas = phantomasResults;
// Mix all DOM Access metrics together
@@ -37,12 +59,25 @@ var Runner = function(params) {
data = mediaQueriesChecker.analyzeMediaQueries(data);
// Redownload every file
return redownload.recheckAllFiles(data);
return redownload.recheckAllFiles(data)
.progress(function(redownloadedProgress) {
deferred.notify({
estimatedProgress: 0.4 + redownloadedProgress * 0.55,
milestone: 'phantomas'
});
});
})
.then(function(data) {
// For the progress bar
deferred.notify({
estimatedProgress: 0.99,
milestone: 'redownload'
});
// Rules checker
var policies = require('./metadata/policies');
data.rules = rulesChecker.check(data, policies);