
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
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
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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.