github.com/hernad/nomad@v1.6.112/ui/app/utils/timeout.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import RSVP from 'rsvp';
     7  
     8  // An always failing promise used to race against other promises
     9  export default function timeout(duration) {
    10    return new RSVP.Promise((resolve, reject) => {
    11      setTimeout(() => {
    12        reject(`Timeout of ${duration}ms exceeded`);
    13      }, duration);
    14    });
    15  }