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

ovh-angular-toaster

v0.8.0

Published

Show a hot toast for user

Downloads

9

Readme

Toaster

githubbanner

Maintenance Chat on gitter Build Status

A factory to create toast

Toaster is a component to show an in-app notification, like a toast for android applications.

Example

Require Angular module toaster. If you need to change theme or css classes, you can define it inside module configuration like this:

angular.module("myApp", ['ovh-angular-toaster']).config(function (ToastProvider) {

    // CSS classes
    ToastProvider.setExtraClasses('messenger-fixed messenger-on-bottom messenger-on-right');

    // Graphic theme
    ToastProvider.setTheme('air');

    // Set duration
    ToastProvider.setHideAfter(42);
});

To add a notification, you had to inject Toast as dependency and use it like this example inside a controller

angular.module('myApp').controller('iLikeLicorn',[ 'Toast', function (Toast) {
    "use strict";

    Toast.success("Licorns eat toast?");

}]);

Toast can by targetted with an ID. So, you can update a toast on-the-fly, like this:

Toast.info('Loading...', {
    id: 42,
    hideAfter: false
});

$timeout(function () {
    Toast.success('Done!', {
        id: 42
    });
}, 2000);

Also, a main Toast fct returns the instance of the Toast created. Then you can play with it!

var msg = Toast.info('Hello!', {
    hideAfter: false
});

$timeout(function () {
    Toast.hide(msg);
    $timeout(function () {
        Toast.show(msg);
    }, 2000);
}, 2000);

Installation

Bower

bower install ovh-angular-toaster --save

NPM

npm install ovh-angular-toaster --save

Get the sources

    git clone https://github.com/ovh-ux/ovh-angular-toaster.git
    cd ovh-angular-toaster
    npm install
    bower install

Warning

By default, CSS from messenger dependency download fonts from google... Two themes are banned :

  • air
  • ice

Don't forgot to disable CSS loading!!!

Toaster include version of these themes without fonts dependencies. To avoid loading CSS file, you had to exclude theses files into your wiredep (in gruntfile.js), like this:

wiredep: {
  target: {
    ...
    exclude: [
        'bower_components/messenger/build/css/messenger-theme-air.css',              'bower_components/messenger/build/css/messenger-theme-ice.css']
  }
},

Features

  • Show a notification with success, error, info or light mode.
  • Can by update on-the-fly!
  • Automatically hidden by default.
  • Doesn't translate message by default. The best way is to translate before send message to Toaster.

Dependencies

API

Main functions

  • Toast.success(message, parameters) show a success notification.
  • Toast.info(message, parameters) show an information notification.
  • Toast.error(message, parameters) show an error notification.
  • Toast.light(message, parameters) show a light notification.

Params:

  • message: message to show
  • parameters: Object to configure lib use to show notification. Please report to Messenger repo documentation. Inside parameters, you can add all parameters from Messenger library: Messenger documentation

Returns:

  • notification: the instance of the Toast.

Others functions

  • Toast.infoWithInProgress(messageProgress, message, parameters) show a info notification with progress information. Return notification reference.
  • Toast.update(notification, message, parameters) update message inside notification. Return operation status.
  • Toast.show(notification) show a specific notification. Return operation status.
  • Toast.hide(notification) hide a specific notification. Return operation status.
  • Toast.hideAll() hide all notification. Return operation status.

You've developed a new cool feature? Fixed an annoying bug? We'd be happy to hear from you!

Have a look in CONTRIBUTING.md

Run the tests

npm test

Build the documentation

grunt ngdocs

Related links

  • Contribute: https://github.com/ovh-ux/ovh-angular-toaster/CONCONTRIBUTING.md
  • Report bugs: https://github.com/ovh-ux/ovh-angular-toaster/issues
  • Get latest version: https://github.com/ovh-ux/ovh-angular-toaster

License

See https://github.com/ovh-ux/ovh-angular-toaster/blob/master/LICENSE