Giter Club home page Giter Club logo

Comments (7)

caroso1222 avatar caroso1222 commented on July 16, 2024 1

Closed in #63. Credits to @bharatramnani94.

from notyf.

caroso1222 avatar caroso1222 commented on July 16, 2024

Hey!

Thanks for bringing this to my attention. There's currently no way to programmatically close the Notyf. I'll work on this feature and add it on v3.x.

from notyf.

caroso1222 avatar caroso1222 commented on July 16, 2024

v3.0.0 has been released with a lot of cool things. I left this for 3.1.0 as I didn't really got time to add this feature, but it's on the roadmap for sure.

from notyf.

azhararmar avatar azhararmar commented on July 16, 2024

Close option would be good, is it coming anytime soon? a button to dismiss would also be good.

from notyf.

bharatramnani94 avatar bharatramnani94 commented on July 16, 2024

Hey @caroso1222
Currently, the success, error and open methods do not return anything.
Maybe they can return the notification (of type NotyfNotification), which can be passed to a new dismiss(notificationToDismiss: NotyfNotification) method to achieve this functionality.
Let me know what you think. Maybe I can take this issue.

from notyf.

caroso1222 avatar caroso1222 commented on July 16, 2024

Hey @bharatramnani94. Yeah, I like that. Thanks for bringing it up again.

I'm still not sure whether to go functional on this one like a method dismiss(notification) on the global instance or OOP-style in the notification instance myNotyf.dismiss().

I'm inclined towards the former as I don't think a notification should be able to call itself dismissed, only the master should. (Just thinking out loud)

I think, then, a good solution would be something like:

const notyf = new Notyf();

const foobar = notyf.success('baz');

setTimeout(() => notyf.dismiss(foobar), 5000);

I'm totally fine if you want to take it, thanks!

Right off the bat, I think renaming _removeNotification to dismiss and making it public would make the trick, but will need testing. It might be a breaking change in case someone is using that private, undocumented method so maybe for backward compatibility purpose we'd just keep it and write a new proxy method dismiss.

from notyf.

bharatramnani94 avatar bharatramnani94 commented on July 16, 2024

Closed in #63. Credits to @bharatramnani94.

Honestly, all credit goes to you @caroso1222. You did the heavy work for it. I'm just glad that this got done.

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.