Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tootallnate/once

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tootallnate/once

Creates a Promise that waits for a single event

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14M
decreased by-14.5%
Maintainers
1
Weekly downloads
 
Created

What is @tootallnate/once?

The @tootallnate/once package is designed to ensure a given function can only be called once. It is particularly useful in scenarios where you want to prevent duplicate execution of event handlers or other functions that should only run a single time during the lifecycle of an application.

What are @tootallnate/once's main functionalities?

Ensuring a function is only called once

This feature allows you to wrap any function with `once` to ensure it can only be executed a single time. Subsequent calls to the wrapped function will have no effect, preventing duplicate execution.

const once = require('@tootallnate/once');

function myFunction() {
  console.log('This will only be logged once.');
}

const wrappedFunction = once(myFunction);
wrappedFunction(); // Logs: 'This will only be logged once.'
wrappedFunction(); // Does nothing on subsequent calls.

Other packages similar to @tootallnate/once

FAQs

Package last updated on 21 Apr 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc