# prelodr

> A simple Material preloader inspired by Google Inbox

Latest version **2.1.1** (published 2017-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install prelodr
pnpm add prelodr
yarn add prelodr
bun add prelodr
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2017-07-02 |
| First published | 2015-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 4.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 67 |
| Author | José Luis Quintana |
| Maintainers | joseluisq |
| Keywords | preloader, minimal, responsive, ui, material-design |

## Links

- npm: https://www.npmjs.com/package/prelodr
- Repository: https://github.com/joseluisq/prelodr
- Homepage: https://github.com/joseluisq/prelodr#readme
- Issues: https://github.com/joseluisq/prelodr/issues
- npm.io page: https://npm.io/package/prelodr

## Dependencies (2)

- [seqr](https://npm.io/package/seqr.md) ^1.0.7
- [emitus](https://npm.io/package/emitus.md) ^2.0.3

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.1.1 (latest) — 2017-07-02
- 2.1.0 — 2017-01-05
- 2.0.4 — 2016-12-06
- 2.0.3 — 2016-12-06
- 2.0.2 — 2016-12-03
- 2.0.1 — 2016-12-03
- 2.0.0 — 2016-11-27
- 1.0.8 — 2016-07-21
- 1.0.7 — 2015-11-22
- 1.0.6 — 2015-11-14
- 1.0.5 — 2015-11-09
- 1.0.4 — 2015-07-30
- 1.0.3 — 2015-07-08
- 1.0.2 — 2015-05-22
- 1.0.1 — 2015-05-20
- … 1 more at https://npm.io/package/prelodr/versions

## README

# Prelodr [![Build Status](https://travis-ci.org/joseluisq/prelodr.svg?branch=master)](https://travis-ci.org/joseluisq/prelodr) [![Coverage Status](https://coveralls.io/repos/github/joseluisq/prelodr/badge.svg?branch=master)](https://coveralls.io/github/joseluisq/prelodr?branch=master) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![CDNJS version](https://img.shields.io/cdnjs/v/prelodr.svg)](https://cdnjs.com/libraries/prelodr)
> A simple Material preloader inspired by Google Inbox.

[![Prelodr preview](https://cloud.githubusercontent.com/assets/1700322/11434023/c12a2918-9493-11e5-943b-eef39f3420e5.gif)](http://cdpn.io/rVeyXY)

:tada: View demo on [Codepen](http://codepen.io/joseluisq/full/rVeyXY)

For React style check out [react-prelodr](https://github.com/joseluisq/react-prelodr).

## Install

[Yarn](https://github.com/yarnpkg/)

```sh
yarn add prelodr --dev
```

[NPM](https://www.npmjs.com/)

```sh
npm install prelodr --save-dev
```

### CDN
The UMD and style files are also available on [unpkg](https://unpkg.com):

```html
<link href="https://unpkg.com/prelodr/dist/prelodr.min.css">
<script src="https://unpkg.com/prelodr/dist/prelodr.min.js"></script>
```

Available on [JSDelivr](https://www.jsdelivr.com/)

```html
<link href="https://cdn.jsdelivr.net/prelodr/latest/prelodr.min.css">
<script src="https://cdn.jsdelivr.net/prelodr/latest/prelodr.min.js"></script>
```
Available on [cdnjs](https://cdnjs.com/libraries/prelodr)

```html
<link href="https://cdnjs.cloudflare.com/ajax/libs/prelodr/2.1.1/prelodr.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/prelodr/2.1.1/prelodr.min.js"></script>
```

You can use the library via `window.prelodr`.

## Usage

```js
const pre = require('prelodr')()

// a) Show prelodr
pre.show('Loading...')

// b) Hide prelodr
pre.hide()
```

### Async and chaining support
`show(fn)` method supports an optional (fn) callback function.

```js
const pre = Prelodr()

// Step 1
pre
  .show('Initializing...')
  .hide(done => {
    console.log(' 1 second delay... ')
    setTimeout(() => {
      done()
    }, 1000)
  })

// Step 2
pre
  .show('Processing...')
  .hide(done => {
    console.log(' 2 seconds delay... ')
    setTimeout(() => {
      done()
    }, 3000)
  })

// Step 3
pre
  .show('Closing...')
  .hide()
```

## Options
- `container` : Container element to append the preloader.
- `zIndex` : `zindex` style value.
- `auto` : If it's `true` preloader shows automaticatly. Default `false`
- `duration` : Timing for show and hide transition.
- `text`: Default showing text.
- `prefixClass` : Prefix class for prelodr. Default is `prelodr` class.

## Methods

### Prelodr.show(text)
Show the prelodr.
- `text` _{String}_ : Text for prelodr.

### Prelodr.hide(fn)
Hide the prelodr.
- `fn` _{Function}_ : (Optional) Callback function

### Prelodr.setPrefixClass(prefix)
- `options` _{String}_ : Set the prefix class.

### Prelodr.setDuration(miliseconds)
- `miliseconds` _{Number}_ : Set the transition timing

### Prelodr.setZIndex(zindex)
- `zindex` _{Number}_ : Set the `zindex` style value.

### Prelodr.getElement()
Return the _{HTMLElement}_ object.

## Events

### Prelodr.on('shown', fn)
Event when prelodr is shown.

### Prelodr.on('hidden', fn)
Event when prelodr is hidden.

## Changelog
Check out the [changelog](https://github.com/joseluisq/prelodr/releases)

## Contributions
If you would like to contribute [pull requests](https://github.com/joseluisq/prelodr/pulls) and [issues](https://github.com/joseluisq/prelodr/issues) will be welcome! Feature requests are welcome too. Please before sending some feature requests make sure provide as much detail and context as possible.

## License
MIT license

© 2017 [José Luis Quintana](http://git.io/joseluisq)

---
_Source: https://npm.io/package/prelodr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
