Skip to content

Commit

Permalink
fix: Restore compatibility with Node.js 8
Browse files Browse the repository at this point in the history
  • Loading branch information
prantlf committed Sep 21, 2019
1 parent 40a7afd commit 8178525
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tasks/html-dom-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,12 @@ module.exports = grunt => {
.catch(() => performConditionalBranch(command.else, false)
.then(resolve, reject))
})
promise.finally(() => grunt.output.writeln('The conditional command ended.'))
promise.then(reportEnd, reportEnd)
return promise

function reportEnd () {
grunt.output.writeln('The conditional command ended.')
}
}

function performConditionalBranch (branch, result) {
Expand Down Expand Up @@ -379,14 +383,16 @@ module.exports = grunt => {

return function (promise) {
if (promise instanceof Promise) {
promise.finally(() => {
clearTimeout(timer)
grunt.output.writeln('The loop ended.')
})
promise.then(finishLoop, finishLoop)
} else {
rejectAll = promise
}
}

function finishLoop () {
clearTimeout(timer)
grunt.output.writeln('The loop ended.')
}
}

function performCommands (subCommands) {
Expand Down

0 comments on commit 8178525

Please sign in to comment.