workbox-core
Version:
This module is used by a number of the other Workbox modules to share common code.
22 lines (18 loc) • 535 B
text/typescript
/*
Copyright 2019 Google LLC
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/
import '../_version.js';
/**
* Returns a promise that resolves and the passed number of milliseconds.
* This utility is an async/await-friendly version of `setTimeout`.
*
* @param {number} ms
* @return {Promise}
* @private
*/
export function timeout(ms: number): Promise<unknown> {
return new Promise((resolve) => setTimeout(resolve, ms));
}