GithubHelp home page GithubHelp logo

Comments (6)

ejci avatar ejci commented on June 1, 2024

Does it happen only for animation type 'none' or also for others?

from favico.js.

tiye avatar tiye commented on June 1, 2024

I don't think so. I justed tried but animations with none slide fade all run into this problem.
And I got some logs, which made me think it breaks every time I set badge 0 after _running was set to true.

2014-08-15T08:23:26.108Z badge -> 0
2014-08-15T08:23:26.555Z badge -> 0
2014-08-15T08:23:26.659Z badge -> 1
2014-08-15T08:23:26.660Z running -> true favico.js:173
2014-08-15T08:23:26.669Z badge -> 0 <-- I think the problem is here.
2014-08-15T08:23:32.275Z badge -> 1
2014-08-15T08:23:32.276Z badge -> 0
2014-08-15T08:23:32.672Z badge -> 1
2014-08-15T08:23:32.939Z badge -> 2 

from favico.js.

tiye avatar tiye commented on June 1, 2024

I think my issue can be fixed by resetting _running to false when I reset the badge. Global state makes me anxious, and I'm not sure if it would affect other parts of you code.
I want to send a PR if you think that line is OK.

/**
 * Set badge
 */
var badge = function(number, opts) {
    opts = ((typeof opts)==='string' ? {animation:opts} : opts) || {};
    _readyCb = function() {
        try {
            if (typeof(number)==='number' ? (number > 0) : (number !== '')) {
                //
                // too long...
                //
                _queue.push(q);
                icon.start();
            } else {
                icon.reset();
                _running = false; // <-- I added two lines here
                console.log((new Date()).toISOString(), 'running -> false, forced');
            }
        } catch(e) {
            throw 'Error setting badge. Message: ' + e.message;
        }
    };
    if (_ready) {
        _readyCb();
    }
};

from favico.js.

ejci avatar ejci commented on June 1, 2024

Good catch!
Send a pull request I will test it and merge it to next version. And I will also make the repo smaller for bower.
Thanks

from favico.js.

amdprophet avatar amdprophet commented on June 1, 2024

Any status updates on getting this merged?

from favico.js.

ejci avatar ejci commented on June 1, 2024

Merged. I will do few more fixes this weekend.

from favico.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.