GithubHelp home page GithubHelp logo

Add yes and no callbacks about notyf HOT 7 CLOSED

caroso1222 avatar caroso1222 commented on July 30, 2024 2
Add yes and no callbacks

from notyf.

Comments (7)

caroso1222 avatar caroso1222 commented on July 30, 2024 4

Thanks for your input @luongvanphuc. I've just opened a PR adding Notyf events. You'll now be able to listen to 'click' and 'dismiss' events.

const notyf = new Notyf();
notyf.success('Foo bar')
     .on('click', () => console.log('I was clicked'));

On the other hand, Yes/No callbacks can be implemented using custom HTML in the message content.

from notyf.

graypegg avatar graypegg commented on July 30, 2024 1

Personally I think this runs against the purpose of this library, sounds like you want more of a dialog then a notification. Check out Vex or Alertify for super-custom dialogs

from notyf.

caroso1222 avatar caroso1222 commented on July 30, 2024 1

Thanks both for your input on this issue!

It's a great idea to have those buttons and callbacks, but I have to agree with @toish in that Notyf's mission is to serve as a pretty simple, minimal library to show simple notifications.

I'm going to close this issue but I'm happy to reopen it if someone else brings back the discussion.

Thanks again for your input and sorry for being so silent lately.

from notyf.

caroso1222 avatar caroso1222 commented on July 30, 2024 1

@kith-and-kin yeah, that functionality is on the PR too. I'm just waiting for Friday to review my PR with a fresh brain. It'll be released on v3.8. Thanks for your input!

from notyf.

jcalixte avatar jcalixte commented on July 30, 2024

Well, I have to agree with you, this library does one thing and does it right.
Thank you for your refs!

from notyf.

luongvanphuc avatar luongvanphuc commented on July 30, 2024

@caroso1222 I've recently replaced toastr with notyf, and found that notyf doesn't have callback options, so I had to come back with toastr.

Personally I think the buttons may be not necessary but the callbacks do. Sometime we want to redirect user to somewhere after clicking on the noti.

I raise my idea here because my company app is really big and the bundle size is a big problem. It's best if we can use tiny libs for big apps.

In the contrary, I also agree with @jcalixte that "this library does one thing and does it right", so it's all up to you.

from notyf.

kith-and-kin avatar kith-and-kin commented on July 30, 2024

Thanks for your input @luongvanphuc. I've just opened a PR adding Notyf events. You'll now be able to listen to 'click' and 'dismiss' events.

const notyf = new Notyf();
notyf.success('Foo bar')
     .on('click', () => console.log('I was clicked');

On the other hand, Yes/No callbacks can be implemented using custom HTML in the message content.

This would be great. I'd love a callback functionality on the dismiss button especially, so we can save whether a message has been dismissed by way of cookie.

from notyf.

Related Issues (20)

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.