![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A delayed function runs some code once a period of time has passed if the delayed function is not being called again in that time.
A delayed function runs some code once a period of time has passed if the delayed function is not being called again in that time.
$ npm install --save delay-me
TypeScript
Delaying a function without recreating it (recommended way)
import {createDelayed} from 'delay-me';
const throttled_resize_handler = createDelayed(() => {
console.log(`I'm a delayed callback. I'm doing some heavy calculations when window size changes`);
});
window.addEventListener('resize', () => throttled_resize_handler.set(250));
// You can force the callback to be executed immediately
// It will cancel the previously set timeout
throttled_resize_handler.now();
// Also, you can cancel a delay
throttled_resize_handler.cancel();
Delaying tagged function in a global delaying context
With this approach, if you will use the same tag for different situations - it will lead to unexpected behavior
import {delay} from 'delay-me';
window.addEventListener('resize', () => {
const cancel = delay('throttled_resize_handler', 250, () => {
console.log(`I'm a delayed callback. I'm doing some heavy calculations when window size changes`);
});
// You can cancel delayed function execution
if(...){
cancel();
}
});
Delaying tagged function in specific context
With this approach, you can use the same tags in different contexts.
import {createDelayContext} from 'delay-me';
const delay1 = createDelayContext();
window.addEventListener('resize', () => {
const cancel = delay1('throttled_resize_handler', 250, () => {
console.log(`I'm a delayed callback. I'm doing some heavy calculations when window size changes`);
});
// You can cancel delayed function execution
if(...){
cancel();
}
});
// Somewhere else in your application
const delay2 = createDelayContext();
// Example of event
something.on('resize', () => {
const cancel = delay2('throttled_resize_handler', 250, () => {
console.log(`I'm doing some heavy calculations when something is resized`);
});
// You can cancel delayed function execution
if(...){
cancel();
}
});
Release under the MIT license
FAQs
A delayed function runs some code once a period of time has passed if the delayed function is not being called again in that time.
The npm package delay-me receives a total of 3 weekly downloads. As such, delay-me popularity was classified as not popular.
We found that delay-me 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.