1
0
Fork 0
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:
Simo Kinnunen 2014-01-29 00:13:29 +09:00
parent a4725fe71c
commit 216592a995
12 changed files with 83 additions and 8 deletions

24
lib/util/promiseutil.js Normal file
View 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)
})
}