GithubHelp home page GithubHelp logo

Comments (5)

CarlosBonetti avatar CarlosBonetti commented on June 18, 2024

Hi @Growiel ! You're right. Right now the first call with any parameter whatsoever will initiate the plugin. So first calls like .loading('whatever'), .loading(5) or .loading(['test', 3, {}]) will all initiate the plugin, completely ignoring the arguments.

What could be done would be throwing an error like "Loading plugin object not initialized on this element" in case any parameter but a config object or start is given as argument. What do you think?

from jquery-loading.

Growiel avatar Growiel commented on June 18, 2024

Hi,

I still believe that nothing happening is the best behavior. When I call "stop", I expect it to stop. If there's nothing to stop because it wasn't started, then nothing happens.

A toggable error (debug: true ?) for the dev stage would be a sweet addition but I think throwing an error all the time is too harsh, sometimes due to timing (AJAX) purposes, my 'stop' will be called and my 'start' never will. I don't want my app to crash in those cases.

from jquery-loading.

CarlosBonetti avatar CarlosBonetti commented on June 18, 2024

Hi @Growiel. I just did an implementation about what we talked at a separate branch. I'm basically starting the plugin just if the calls are:

$(...).loading('start');
$(...).loading('toggle');
$(...).loading();
$(...).loading({ ... })

Everything else will be ignored and won't start the plugin. I also did some unit tests.

Can you take a look at 9c68d36 before I merge it to master?

from jquery-loading.

Growiel avatar Growiel commented on June 18, 2024

Hi, sorry for the long delay.

I tested it and it seems to be doing what we would expect.

Thanks for the quick fix!

from jquery-loading.

CarlosBonetti avatar CarlosBonetti commented on June 18, 2024

Thanks for the help!

from jquery-loading.

Related Issues (19)

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.