All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.build.cjs.vercelWaitUntil.js Maven / Gradle / Ivy

There is a newer version: 8.38.0
Show newest version
Object.defineProperty(exports, '__esModule', { value: true });

const worldwide = require('./worldwide.js');

/**
 * Function that delays closing of a Vercel lambda until the provided promise is resolved.
 *
 * Vendored from https://www.npmjs.com/package/@vercel/functions
 */
function vercelWaitUntil(task) {
  const vercelRequestContextGlobal =
    // @ts-expect-error This is not typed
    worldwide.GLOBAL_OBJ[Symbol.for('@vercel/request-context')];

  const ctx =
    vercelRequestContextGlobal && vercelRequestContextGlobal.get && vercelRequestContextGlobal.get()
      ? vercelRequestContextGlobal.get()
      : {};

  if (ctx && ctx.waitUntil) {
    ctx.waitUntil(task);
  }
}

exports.vercelWaitUntil = vercelWaitUntil;
//# sourceMappingURL=vercelWaitUntil.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy