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

@libp2p/utils

Package Overview
Dependencies
Maintainers
6
Versions
607
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/utils - npm Package Compare versions

Comparing version 6.4.0-80ddad5bb to 6.4.0-d61cbacec

26

dist/src/repeating-task.d.ts
import type { AbortOptions } from '@libp2p/interface';
export interface RepeatingTask {
/**
* Update the interval after which the next iteration of the task will run.
*
* This is useful if, for example, you want to retry a task with a short rest
* duration until it succeeds, then periodically after that.
*
* This only affects the next iteration of the task, if it is currently
* running, that run will not be interrupted.
*/
setInterval(ms: number): void;
/**
* Update the amount of time a task will run before the passed abort signal
* will fire.
*
* * This only affects the next iteration of the task, if it is currently
* running, that run will not be interrupted.
*/
setTimeout(ms: number): void;
/**
* Start the task running
*/
start(): void;
/**
* Stop the task running
*/
stop(): void;

@@ -14,2 +38,4 @@ }

* Whether to schedule the task to run immediately
*
* @default false
*/

@@ -16,0 +42,0 @@ runImmediately?: boolean;

@@ -30,2 +30,16 @@ import { setMaxListeners } from '@libp2p/interface';

return {
setInterval: (ms) => {
interval = ms;
// maybe reschedule
if (timeout != null) {
clearTimeout(timeout);
timeout = setTimeout(runTask, interval);
}
},
setTimeout: (ms) => {
if (options == null) {
options = {};
}
options.timeout = ms;
},
start: () => {

@@ -32,0 +46,0 @@ if (started) {

10

package.json
{
"name": "@libp2p/utils",
"version": "6.4.0-80ddad5bb",
"version": "6.4.0-d61cbacec",
"description": "Package to aggregate shared logic and dependencies for the libp2p ecosystem",

@@ -184,5 +184,5 @@ "license": "Apache-2.0 OR MIT",

"@chainsafe/netmask": "^2.0.0",
"@libp2p/crypto": "5.0.10-80ddad5bb",
"@libp2p/interface": "2.4.1-80ddad5bb",
"@libp2p/logger": "5.1.7-80ddad5bb",
"@libp2p/crypto": "5.0.10-d61cbacec",
"@libp2p/interface": "2.4.1-d61cbacec",
"@libp2p/logger": "5.1.7-d61cbacec",
"@multiformats/multiaddr": "^12.3.3",

@@ -208,3 +208,3 @@ "@sindresorhus/fnv1a": "^3.1.0",

"devDependencies": {
"@libp2p/peer-id": "5.0.11-80ddad5bb",
"@libp2p/peer-id": "5.0.11-d61cbacec",
"@types/netmask": "^2.0.5",

@@ -211,0 +211,0 @@ "aegir": "^45.0.5",

@@ -6,3 +6,30 @@ import { setMaxListeners } from '@libp2p/interface'

export interface RepeatingTask {
/**
* Update the interval after which the next iteration of the task will run.
*
* This is useful if, for example, you want to retry a task with a short rest
* duration until it succeeds, then periodically after that.
*
* This only affects the next iteration of the task, if it is currently
* running, that run will not be interrupted.
*/
setInterval(ms: number): void
/**
* Update the amount of time a task will run before the passed abort signal
* will fire.
*
* * This only affects the next iteration of the task, if it is currently
* running, that run will not be interrupted.
*/
setTimeout(ms: number): void
/**
* Start the task running
*/
start(): void
/**
* Stop the task running
*/
stop(): void

@@ -20,2 +47,4 @@ }

* Whether to schedule the task to run immediately
*
* @default false
*/

@@ -59,2 +88,18 @@ runImmediately?: boolean

return {
setInterval: (ms) => {
interval = ms
// maybe reschedule
if (timeout != null) {
clearTimeout(timeout)
timeout = setTimeout(runTask, interval)
}
},
setTimeout: (ms) => {
if (options == null) {
options = {}
}
options.timeout = ms
},
start: () => {

@@ -61,0 +106,0 @@ if (started) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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