Giter Site home page Giter Site logo

saulgavrilov / notification-library Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 8 KB

Notification.js is a JavaScript notification library for displaying customizable, dismissable, sliding notification popups.

License: MIT License

JavaScript 72.21% CSS 27.79%
javascript library notification

notification-library's Introduction

Notification Library

Options

Options Type Description
text string Notcification message
position string One of top-right, top-center, top-left, bottom-right, bottom-center, bottom-left
autoClose bool | number Delay in ms to close the notification. If set to false, the notification needs to be closed manually
style object Add optional inline style to the notification element
canClose bool Dismiss notification close functionality
showProgress bool Display or not the progress bar below the notification(remaining time)
pauseOnHover bool Keep the timer running or not on hover
pauseOnFocusLoss bool Pause the timer when the window loses focus

Default Options

Options Default
text empty string
position top-right
autoClose 3000
style empty object
canClose true
showProgress true
pauseOnHover true
pauseOnFocusLoss true

Usages

// After the notification has been closed by autoClose or by the user
// You will not be able to use the notofication variable again
// To use it more than one time, make sure that you disable the autoClose & canClose
const notification = new Notification({
  text: 'Hello World !',
});

// The update function will run only if the notification is still visible
setTimeout(() => {
  notification.update({
    style: {
      background: '#2e344e',
      color: '#ffffff',
      transition: 'all 350ms linear',
    },
  });
}, 1500);

notification-library's People

Contributors

sgavrielov avatar

Stargazers

 avatar Berat Batuhan Keten avatar

Watchers

James Cloos avatar  avatar

notification-library's Issues

Cant create a new line in notification

Hello Firstly,

I need a huge notification toast for my project. When i used sentences more than one, i cant create new line between 2 sentences. Is there a bug or something here is the example:

const notification = new Notification({
                    text: 'asdasdasd\n asdasdsadasd\n asdadasd',
                    position: 'top-center',
                    style: {
                        "background": '#2e344e',
                        "color": '#ffffff',
                    },
                    autoClose: 20000,
                    pauseOnHover:false
                });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.