Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
async-task
Advanced tools
Execute tasks asynchronous tasks without seperate files. In browsers without Worker
support it fallbacks to iframe
.
In Nodejs it spawns a process using child_process
.
npm install async-task
Also support bower
bower install async-task
var AsyncTask = require( 'async-task' )
var task = new AsyncTask({
doInBackground: (a, b) -> a + b
})
task.execute(1, 2)
.then(function( result ) {
result === 3
})
.catch( handleException )
var task = new AsyncTask( (a, b) -> a + b, options )
Creates a new AsyncTask
options.doInBackground
The work(function) to be done in the worker if the first argument isnt the task.options.keepAlive
Keep worker alive so .execute
can be called multiple times.options.worker
Supply worker if you want to share worker between tasks. NB!: termination of worker is left to the userExecute the doInBackground
function with supplied args.
var AsyncTask = require( 'async-task' )
var BackgroundWorker = require( 'background-worker' )
var worker = new BackgroundWorker({})
var taskA = new AsyncTask({
worker: worker,
doInBackground: () -> 'a'
})
var taskB = new AsyncTask({
worker: worker,
doInBackground: () -> 'b'
})
Promise.all([
taskA.execute(),
taskB.execute()
]).then(function(result) {
result == [ 'a', 'b' ]
worker.terminate()
})
npm run-script test
doInBackground
can return a promise or maybe even a generator*
so you can iterate over asyncTask.execute
If your using it in your very cool project please drop me a note on jornandretangen àt
gmail.com
Partially made, with <3 at:
FAQs
Run a AsyncTask using a web worker or child_process.
We found that async-task demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.