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

safe-spinner

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

safe-spinner

A react wrapper for spinners with a timeout

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Safe Spinner

This package helps address the risk of 'infinite spinners' by allowing you to fire a handler when they occur. Generally this would send an event to a service like Sentry.

This component only renders it's children, it does not add any new UI element.

Installation

npm install safe-spinner

yarn add safe-spinner

Note: typescript definitions are included out of the box

Usage

Props

nametyperequireddefault
onTimeout() => voidyesundefined
timeoutnumber (ms)no10000

Using the default 10 second timeout

import React from 'react';
import SafeSpinner from 'safe-spinner';
import Spinner from './Spinner';

const handleSpinnerTimeout = () => {
  console.log('the spinner timed out after the 10 second default');
};
const MyComponent = () => {
  <SafeSpinner onTimeout={handleSpinnerTimeout}>
    <Spinner />
  </SafeSpinner>;
};

Using a custom timeout

import React from 'react';
import SafeSpinner from 'safe-spinner';
import Spinner from './Spinner';

const handleSpinnerTimeout = () => {
  console.log('the spinner timed out after 60 seconds ');
};
const MyComponent = () => {
  <SafeSpinner onTimeout={handleSpinnerTimeout} timeout={60000}>
    <Spinner />
  </SafeSpinner>;
};

FAQs

Package last updated on 17 Feb 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