Giter Site home page Giter Site logo

periodic's People

Contributors

jorgemanrubia avatar lmarlow avatar tra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

periodic's Issues

destroy persiodic when element is removed

hi,
can we destroy the periodic function when an element is removed ?
because what i am facing is that if an element with periodic is attached to is removed before the period time is over, periodic will still execute the function.

thanks in advanced.

cancel wont work for me.

Great work on the plugin.
I cant get the cancel function to do what it is supposed to do i think.

Im not a pro but i hacked the cancel function to get it to work.

function cancel() {
    settings.tid = undefined;
}

I also needed to change the run function:
function run() {
// clear/stop existing timer (multiple calls to run() won't result in multiple timers)
cancel();
// let it rip!
settings.tid = setTimeout(function() {
// set the context (this) for the callback to the settings object
callback.call(settings);

  if (settings.tid != undefined){
  // compute the next value for cur_period
  increment();
  // queue up the next run
  run();
  }
}, settings.cur_period);
}

got 2 periods running and this only affects the one i cancel.
If u got a better fix or an explanation why it not works for me ill be happy to hear.
yol

Edit: sry missed the earlier issue posted.

cancel() does not stop immediately

Hi,

First off, thanks for this really great implementation. I'm currently trying to cancel the whole polling if the server script returns an error. How I do this is the error message is communicated via json from the server. My code is like this:

success: function(data) {
if (data.status == 0) {
alert(data.msg);
this.periodic.cancel();
}
}

the problem with the above is that after the first error is received, periodic goes on to allow another cycle before it finally stops completely. The user in this instance will receive two alert boxes.

How can I make it such that it stops the moment i call cancel()?

Thanks :)

cancel from an external call

Hi,

I'd like to cancel the polling if say a button is clicked... however I'm not sure how to get a handle into the polling process to cancel it.

Thanks!

Setting this.periodic.cur_period does not appear to work

Hi,

I'm trying to assign a value to this while periodic is doing its loop, but it doesn't seem to have any effect.

I run periodic upon $(document).ready(function () {}); and I notice the first and 2nd iteration is almost immediately after. I'm trying to space the 2nd iteration further from the first.

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.