Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Serial flow control toy for Node.js
function(err,data){}
and the last argument of calling functions)Functions compatible with parley must have a callback as their last parameter. If you plan to work with the results of asynchronous calls (which is often), you should plan for an err and data argument.
// A parley-equivalent setTimeout
function wait (ms,cb) {
setTimeout(cb,ms);
}
// A parley-equivalent console.log
// (accepts deferred data as input)
function log (err,data,cb) {
if (err) console.error(err,cb);
else console.log(data,cb);
}
var parley = require ('parley');
// Start a sequence
var $$ = new parley();
// Do some asynchronous things
$$(wait) (100);
$$(log) ("100 ms later...");
$$(wait) (100);
$$(log) ("200 ms later...");
$$(wait) (100);
$$(log) ("300 ms later...");
// Handle deferred results
var result = $$(apiCall) ("http://google.com/v2");
// Result object is automatically converted to (err,data) arguments in $$(log)
$$(log) (result);
Multiple parley sequences can be run at the same time:
// Do a few things at once
var $render = new parley();
var $templates = new parley();
var $session = new parley();
// Wait until the document is ready
$render(jQuery.ready) ();
// Simultaneously, go fetch templates from jQuery
$templates(jQuery.get) ('http://templates.com', { production: true });
// Also go grab logged-in session data from the server
$session(jQuery.get) ('/user/sessionData', {});
// When all sequences are complete..
var $done = new parley($render,$templates,$session);
// Render the UI
$done(AppUI).render ();
$done(log) ('All done!');
For convenience, objects wrapped in a parley have all of their methods converted to parley functions. For instance, $$(User).find(foo)
is equivalent to $$(User.find)(foo)
// Create a parley sequence
var $$ = new parley();
// Call $$(User.find) by wrapping the User object
var user = $$(User).find(17);
FAQs
Practical, lightweight flow control for Node.js. Supports `await`, callbacks and promises.
The npm package parley receives a total of 13,762 weekly downloads. As such, parley popularity was classified as popular.
We found that parley demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.