open-nomad/ui/app/utils/timeout.js

11 lines
284 B
JavaScript
Raw Normal View History

import RSVP from 'rsvp';
2017-09-19 14:47:10 +00:00
// An always failing promise used to race against other promises
export default function timeout(duration) {
return new RSVP.Promise((resolve, reject) => {
setTimeout(() => {
reject(`Timeout of ${duration}ms exceeded`);
}, duration);
});
}