Code Monkey home page Code Monkey logo

Comments (7)

wavded avatar wavded commented on July 18, 2024

correct, a zero timeout never times out so you have to force remove it with humane.remove()

from humane-js.

nowotny avatar nowotny commented on July 18, 2024

Yes... that's what I'm doing... or am I not...?

Subsequent calling of my a1() function should produce the same result... a notification should be removed if it's present and a new one with timeout=0 should show up and stay, while now, on every second call it disappears after 2,5 seconds...

from humane-js.

wavded avatar wavded commented on July 18, 2024

i'm confused, setting timeout of 0 is supposed to never close yet you want it to after a certain amount of time? would this be a better case for using waitForMove ? I guess I'll need help understanding your use case.

from humane-js.

nowotny avatar nowotny commented on July 18, 2024

I want to do the following:

  1. clear previous notification if there is any
  2. set timeout to 0 so the new notification stays
  3. show new notification
  4. set timeout back to default value in case I need it later for other type of notification

All the above should happen every time I call the a1() function, so when the function "is done" there should always be a notification showing and it should stay until I manually remove it... instead, every second call of the function shows the notification but it disappears after 2,5 seconds instead of staying on...

from humane-js.

wavded avatar wavded commented on July 18, 2024

ahh i see, remove really should take a callback, since what is happening is your next call isn't being queued up until after the animation has finished (and you've set the timeout to 5 seconds), so when it arrives in the queue it is no longer timeout=0 but timeout=5000 (or whatever you set it to). I'm thinking about enhancements to this API that would make it easier for you do what you want...

from humane-js.

wavded avatar wavded commented on July 18, 2024

for now to get what you want, you could either put a setTimeout on your timeout=5000 setting, or just have another function that does humane.remove(); humane.timeout = 5000; humane('your message') and remove humane.timeout = 5000 in your other function

from humane-js.

wavded avatar wavded commented on July 18, 2024

i added a callback to the remove function

from humane-js.

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.