New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

zpromise

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zpromise - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

4

index.js

@@ -56,3 +56,3 @@ class zPromise {

*/
promise.restart = function (options) {
promise.restart = function (newOptions) {

@@ -62,3 +62,3 @@ if (promise.state === 'pending') {

} else {
return new zPromise(options)
return new zPromise(newOptions || options)
}

@@ -65,0 +65,0 @@

{
"name": "zpromise",
"version": "1.1.2",
"version": "1.1.3",
"description": "Promise简化包装器,用于增强已有ES6 Promise的易用性",

@@ -5,0 +5,0 @@ "main": "index.js",

<!-- Promise简化包装器,用于增强已有ES6 Promise的易用性 -->
## Install
```
npm install zpromise
```
## 特性

@@ -7,14 +13,8 @@

* 支持promise重启,可复用配置项
* 支持Promise重启、可复用配置项
* 支持promise等待超时
* 支持Promise等待超时
* 支持state属性获取当前promise状态
* 支持获取Promise实例当前状态
## Install
```
npm install zpromise
```
## 示例

@@ -45,3 +45,5 @@

await promise
await promise.catch(message => {
console.error(message)
})

@@ -91,21 +93,23 @@ console.log(promise.state)

### zPromise({ time, message })
#### zPromise(options)
* time 超时时间,单位ms,可选
* `options` *Object* 配置选项
* message 超时描述信息,可选
* `time` *Number* 超时时间,单位ms,可选
### this.state
* `message` *String* 超时描述信息,可选
#### this.state
当前promise状态,值分别为pending、resolve、reject
### this.resolve()
#### this.resolve()
代理Promise注入函数中的resolve,成功时执行
### this.reject()
#### this.reject()
代理Promise注入函数中的reject,失败时执行
### this.restart(options)
#### this.restart(options)

@@ -112,0 +116,0 @@ * options 与zPromise创建实例时的参数一样

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc