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

@brainsights/promise-task

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@brainsights/promise-task - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

46

index.js

@@ -143,47 +143,1 @@ const EventEmitter = require("events")

module.exports = Task;
(async () => {
try {
let task1 = new Task(async (context) => {
let progress = 0;
let timer;
timer = setInterval(() => {
progress += 1;
if(progress >= 100) {
clearTimeout(timer);
context.progress(100);
context.resolve();
} else {
context.progress(progress);
}
}, 10);
context.onCancel = () => {
clearTimeout(timer);
};
});
let task2 = new Task(async (context) => {
let progress = 0;
let timer;
timer = setInterval(() => {
progress += 1;
if(progress >= 100) {
clearTimeout(timer);
context.progress(100);
context.resolve();
} else {
context.progress(progress);
}
}, 100);
context.onCancel = () => {
clearTimeout(timer);
};
});
let batch = Task.series([task1, task2]);
batch.on("progress", (progress) => console.log(progress));
await batch.run();
} catch(e) {
console.trace(e);
}
})();

2

package.json
{
"name": "@brainsights/promise-task",
"version": "1.0.1",
"version": "2.0.0",
"description": "Lazy promises with support for cancellation and progress events",

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

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