p-defer

WebJar for p-defer

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

p-defer
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

p-defer
WebJar for p-defer
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/sindresorhus/p-defer

Скачать p-defer

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/p-defer/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>p-defer</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/p-defer/
implementation 'org.webjars.npm:p-defer:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/p-defer/
implementation ("org.webjars.npm:p-defer:1.0.0")
'org.webjars.npm:p-defer:jar:1.0.0'
<dependency org="org.webjars.npm" name="p-defer" rev="1.0.0">
  <artifact name="p-defer" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='p-defer', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "p-defer" % "1.0.0"
[org.webjars.npm/p-defer "1.0.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

p-defer

Create a deferred promise

Don't use this unless you know what you're doing. Prefer the Promise constructor.

Install

$ npm install p-defer

Usage

const pDefer = require('p-defer');

function delay(ms) {
	const deferred = pDefer();
	setTimeout(deferred.resolve, ms, '🦄');
	return deferred.promise;
}

(async () => {
	console.log(await delay(100));
	//=> '🦄'
})();

The above is just an example. Use delay if you need to delay a promise.

API

pDefer()

Returns an object with a promise property and functions to resolve() and reject().

Related

  • p-lazy - Create a lazy promise that defers execution until .then() or .catch() is called
  • More…

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Версии библиотеки

Версия
1.0.0