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.1.2
  • Source
  • npm
  • Socket score

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

  

🕔🚀 Fast Defer




Stars License Size Downloads NPM



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



Table of contents


Installing

Node
npm install --save fast-defer
# or
yarn add fast-defer
const { deferred, isDeferred } = require('fast-defer');
// or
import { deferred, isDeferred } from 'fast-defer';
Browser

Downloads

<!-- Make sure to use the latest version -->

<script crossorigin src="https://cdn.jsdelivr.net/npm/fast-defer@1.1.2"></script>
<!-- Or -->
<script crossorigin src="https://unpkg.com/fast-defer@1.1.2"></script>
const { deferred, isDeferred } = window.FastDefer;

Browser Compatibility

ChromeEdgeFirefoxInternet ExplorerOperaSafariNode.jsDenoWebView AndroidChrome AndroidFirefox for AndroidOpera AndroidSafari on iOSSamsung Internet
Promise() constructor321229*X1980.121.04.4.33229*198*2.0
Symbol() constructor381236X2590.121.03838362593.0

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('Resolved');
});

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

// Other file, function or etc
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