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.3 to 1.2.0

12

index.js
class zPromise {
/**
*
* @param {Number} time 超时时间,单位ms
* @param {Number} timeout 超时时间,单位ms
*/
constructor(options = {}) {
let { time, message } = options
let { timeout, message } = options

@@ -18,8 +18,8 @@ let callback

if (time) {
if (timeout) {
let timeId = setTimeout(() => {
callback.reject(message || `Promise等待超过${time}ms`)
callback.reject(message || `Promise等待超过${timeout}ms`)
promise.state = 'reject'
}, time);
}, timeout);

@@ -33,7 +33,5 @@ promise.resolve = function (data) {

promise.reject = function (data) {
clearTimeout(timeId)
callback.reject(data)
promise.state = 'reject'
}

@@ -40,0 +38,0 @@

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

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

@@ -13,4 +13,2 @@ <!-- Promise简化包装器,用于增强已有ES6 Promise的易用性 -->

* 支持Promise重启、可复用配置项
* 支持Promise等待超时

@@ -20,2 +18,4 @@

* 支持Promise重启,可复用配置项
## 示例

@@ -97,3 +97,3 @@

* `time` *Number* 超时时间,单位ms,可选
* `timeout` *Number* 超时时间,单位ms,可选

@@ -100,0 +100,0 @@ * `message` *String* 超时描述信息,可选

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