mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Push vendor files to devices.
This commit is contained in:
parent
a4725fe71c
commit
216592a995
12 changed files with 83 additions and 8 deletions
24
lib/util/promiseutil.js
Normal file
24
lib/util/promiseutil.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
var Promise = require('bluebird')
|
||||
|
||||
module.exports.periodicNotify = function(promise, interval) {
|
||||
var resolver = Promise.defer()
|
||||
, timer = setInterval(notify, interval)
|
||||
|
||||
function notify() {
|
||||
resolver.progress()
|
||||
}
|
||||
|
||||
function resolve() {
|
||||
resolver.resolve()
|
||||
}
|
||||
|
||||
function reject() {
|
||||
resolver.reject()
|
||||
}
|
||||
|
||||
promise.then(resolve, reject)
|
||||
|
||||
return resolver.promise.finally(function() {
|
||||
clearInterval(timer)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue