Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andreruffert/snackbar

🍫 Lightweight feedback notifications
https://github.com/andreruffert/snackbar

javascript notifications

Last synced: about 1 month ago
JSON representation

🍫 Lightweight feedback notifications

Awesome Lists containing this project

README

        

# snackbar

[![npm version](https://img.shields.io/npm/v/snackbar.svg)](https://www.npmjs.com/package/snackbar)
[![npm downloads](https://img.shields.io/npm/dm/snackbar?logo=npm)](https://www.npmjs.com/package/snackbar)

> Lightweight feedback notifications

## Install

```
$ npm install --save snackbar
```

## Usage

1. First of all make sure to import the [snackbar.scss](https://github.com/andreruffert/snackbar/blob/master/src/snackbar.scss) file into your project.

2. Use the snackbar.js API
```js
const snackbar = require('snackbar');

// Optional configuration
snackbar.duration = 5000;
snackbar.gap = 250;

// Show the snackbar or add it to the queue
snackbar.show('Ohai!');
```

## API

### snackbar.show(message)

#### message

Type `string`

### snackbar.duration

Time to show snackbar before hiding (default 5000)

Type `number`

### snackbar.gap

Time between sequential snackbars (default 250)

Type `number`

## License

MIT Β© [AndrΓ© Ruffert](http://andreruffert.com)