
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
promise-ext-delay
Advanced tools
Simple delay promise.
require('promise-ext-delay')();
Promise.delay(1000).then(function(){...})
This is realization of a small and simple delay promise, that supports CommonJS, AMD ang non-module definition.
The module is function, that extends any promise constructor and first of all, you'll need to call this function to extend promise constructor.
Injection for CommonJS:
require('promise-ext-delay')();
Injection for AMD:
require(['promiseDelay'], function(PromiseDelay){
PromiseDelay();
});
Injection for non-module environment:
<script src="promiseDelay.min.js"></script>
<script>
PromiseDelay(); //in non-module environment, global function PromiseDelay will be created
</script>
The function that injects delay promise have 2 parameters:
PromiseConstructor
- just function-constructor, that will be extended. If nothing is passed, then default promise constructor will be used.extName
- name of the delay function/method. If nothing is passed, then delay
will be used. Can be passed instead of the first parameter.Some examples of injection:
PromiseDelay(); //or
PromiseDelay(YourCustomPromiseConstructor, 'methodName'); //or
PromiseDelay('methodName');
After injection, you'll may use delay promise:
As static function
Promise.delay(1000).then(function(){...})
Or as object method
var p = new Prmise(function(resolve){
resolve('some value');
});
p.delay(5000).then(function(){...});
Notice that delay promise will pass promise value through itself, therefore you'll receive your value in promise chain after delay promise.
FAQs
Simple delay promise
The npm package promise-ext-delay receives a total of 6 weekly downloads. As such, promise-ext-delay popularity was classified as not popular.
We found that promise-ext-delay 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.