Sha256: 00fc331feb8f54ad39747bb3646bf0d4aae60d60420abfa970eef728835fcf0a

Contents?: true

Size: 388 Bytes

Versions: 2

Compression:

Stored size: 388 Bytes

Contents

export async function delay({seconds, milliseconds} = {}) {
	let duration;
	if (typeof seconds === 'number') {
		duration = seconds * 1000;
	} else if (typeof milliseconds === 'number') {
		duration = milliseconds;
	} else {
		throw new TypeError('Expected an object with either `seconds` or `milliseconds`.');
	}

	return new Promise(resolve => {
		setTimeout(resolve, duration);
	});
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcp-server-ruby-sdk-0.0.6 node_modules/unicorn-magic/default.js
pcp-server-ruby-sdk-0.1.0 node_modules/unicorn-magic/default.js