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

fast-defer

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-defer

🕔 Fast and minimal deferred implementation for javascript

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
122K
increased by7.2%
Maintainers
1
Weekly downloads
 
Created
Source

  

🕔🚀 Fast Defer




Forks Issues Stars License Codecov Npm



fast-defer is a fast and minimal deferred implementation for javascript



Installing

Node
npm install --save fast-defer

yarn add fast-defer
const { deferred, isDeferred } = require('fast-defer');
// or
import { deferred, isDeferred } from 'fast-defer';
Browser
<script crossorigin src="https://unpkg.com/fast-defer@1.0.0"></script>
const { deferred, isDeferred } = window;

Table of contents


Browser Compatibility


Getting Started

Fast defer is nothing more than a promise that you can resolve or reject later.

import { deferred, isDeferred } from 'fast-defer';

const waitingSomething = deferred();

waitingSomething.then((val) => {
  console.log('2) Resolved');
});

waitingSomething.catch((error) => {
  console.log('2) Rejected');
});

someCallback((response, error) => {
  if (error) {
    waitingSomething.reject(error);
  } else {
    waitingSomething.resolve(response);
  }
});

License

Licensed under the MIT. See LICENSE for more informations.


Contact

See my contact information on my github profile or open a new issue.


Keywords

FAQs

Package last updated on 08 Dec 2021

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