npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

splashr

v0.3.0

Published

A React component that adds a Splash Screen to your app.

Downloads

24

Readme

🌊 Splashr

A React component that takes the effort out of adding a Splash Screen to your web application.

❤️ it? ⭐️ it on GitHub or Tweet about it.

npm version All Contributors

New in Version 0.3.x

  • Support for React Suspense and lazy loading of components (see below for details)!

Installation

$ npm i splashr

or

$ yarn add splashr

⚠️ Note: Splashr has a peerDependency on React 16.8.0 or greater.

Basic Usage

Here is a simple example use of Splashr.

import Splashr from 'splashr';

const splash = (
  <div className="splash-screen">
    Welcome to my app
  </div>
);

const App = () => (
  <Splashr splash={splash}>
    <div className="app">
      This is my app.
    </div>
  </Splashr>
);

Props

Here are some of the props that you can use to customize Splashr. (* = required)

| Parameter | Description | | :-------- | :----------------------------------------- | | splash* | Your rendered splash screen. | | children* | Your app. | | minDelay | How long to show the splash screen in msecs. Default = 2000 | | extend | A boolean that will extend the splash screen. Set to true to extend the splash screen past minDelay, maybe to load a resource. Default = false. | | transitionTime | By default, Splashr will transition between the splash screen and your app. This value will set the transition time in msecs. To disable the transition, set transitionTime to 0. Default = 700 | | transitionTimingFunction | The string representing the timing function to perform on the transition. Default = "ease" |

Suspense

Starting with version 0.3.0, there is support for React Suspense and lazy loading.

Let's say you lazy load some components. With Suspense, the splash screen will remin visible for at least 2 seconds (by default, or whatever value you speify in minDelay), but possibly longer if the components have yet to load. This is very useful for slower 2G/3G connections on mobile devices.

One might do this to get the splash screen rendered as soon as possible while the rest of the app is sill loading (or First Meaningful Paint).

To support Suspense, simply change <Splashr> to <Splashr.Suspense>. All props are supported except extend, which is ignored with <Splashr.Suspense>.

import Splashr from 'splashr';

const OtherComponent = React.lazy(() => import('./OtherComponent'));
const AnotherComponent = React.lazy(() => import('./AnotherComponent'));

const splash = (
  <div className="splash-screen">
    Welcome to my app
  </div>
);

const App = () => (
  <Splashr.Suspense splash={splash}>
    <div className="app">
      <OtherComponent />
      <AnotherComponent />
    </div>
  </Splashr.Suspense>
);

Why not just use React's Suspense?

Splashr.Suspense is simular to React's built-in Suspense (in fact it's built on top of it), but supports a smooth transition between the splash screen and the rest of the app. it also supports a minDelay, which React's Suspense does not.

Sample Apps

Here is a list of apps build with Splashr. If you have an app you would like to include on this list, open a PR.

License

MIT Licensed

Contributors

Thanks goes to these wonderful people (emoji key):

| Donavon West🚇 ⚠️ 💡 🤔 🚧 👀 🔧 💻 | | :---: |

This project follows the all-contributors specification. Contributions of any kind welcome!