Skip to content

Scoping issue (reported by Jens Meineck) #29

@heartcode

Description

@heartcode

I've started using your canvas loader script - it is simply awesome...

Everything worked fine until I did some tidying up of my code today when canavasloader stopped working.

A little digging revealed that you have the following lines in your code:

    /**
    * Shows the rendering of the loader animation
    * @method show
    * @public
    */
    p.show = function () {
            if (typeof (this.timer) !== "number") {
                    var t = this;
                    this.timer = self.setInterval(function () { t.tick(); }, Math.round(1000 / this.fps));
                    setCSS(this.cont, {display: "block"});
            }
    };

notice the

    self.setInterval (.....

since you never define self it resolved it to another object in my scope that cause a problem. Removing the

    self.

from the expression seems to fix the problem.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions