open-nomad/ui/app/utils/timeout.js
Alex Dadgar e5ec915ac3 sync
2017-09-19 10:08:23 -05:00

13 lines
311 B
JavaScript

import Ember from 'ember';
const { RSVP } = Ember;
// 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);
});
}