Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

timechain

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timechain - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

test/promise.js

14

index.js

@@ -8,4 +8,6 @@ "use strict"

*/
constructor({ timeout } = {}) {
constructor(options = {}) {
let { timeout = 0 } = options
this.timeout = timeout

@@ -20,3 +22,3 @@ this.tasks = new Map()

*/
set(key, value, timestamp = Date.now()) {
set(key, value, timestamp) {

@@ -30,2 +32,6 @@ // 仅在定时队列为空时允许启动

if (!timestamp) {
timestamp = Date.now() + this.timeout
}
return this.tasks.set(key, { value, timestamp })

@@ -68,4 +74,4 @@

for (let key of keys) {
let { timestamp, value } = this.tasks.get(key)
let timeout = 30 - (Date.now() - timestamp)
let { value, timestamp } = this.tasks.get(key)
let timeout = timestamp - Date.now()
if (timeout > 0) {

@@ -72,0 +78,0 @@ this.run(timeout)

{
"name": "timechain",
"version": "1.1.0",
"version": "1.1.1",
"description": "时间队列链式触发器",

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

@@ -9,2 +9,14 @@ let timeChain = require('..')

}, 888)
}, 111)
timechain.set(function (value) {
console.log(value)
}, 222)
timechain.set(function (value) {
console.log(value)
}, 333)

@@ -5,4 +5,4 @@ let timeChain = require('..')

timechain.set(function(){
console.log(999)
}, undefined, Date.now() + 5000)
timechain.set(function(value){
console.log(value)
}, 999, Date.now() + 5000)
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