Skip to content

Commit 8178525

Browse files
committed
fix: Restore compatibility with Node.js 8
1 parent 40a7afd commit 8178525

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

tasks/html-dom-snapshot.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ module.exports = grunt => {
261261
.catch(() => performConditionalBranch(command.else, false)
262262
.then(resolve, reject))
263263
})
264-
promise.finally(() => grunt.output.writeln('The conditional command ended.'))
264+
promise.then(reportEnd, reportEnd)
265265
return promise
266+
267+
function reportEnd () {
268+
grunt.output.writeln('The conditional command ended.')
269+
}
266270
}
267271

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

380384
return function (promise) {
381385
if (promise instanceof Promise) {
382-
promise.finally(() => {
383-
clearTimeout(timer)
384-
grunt.output.writeln('The loop ended.')
385-
})
386+
promise.then(finishLoop, finishLoop)
386387
} else {
387388
rejectAll = promise
388389
}
389390
}
391+
392+
function finishLoop () {
393+
clearTimeout(timer)
394+
grunt.output.writeln('The loop ended.')
395+
}
390396
}
391397

392398
function performCommands (subCommands) {

0 commit comments

Comments
 (0)