tra / periodic Goto Github PK
View Code? Open in Web Editor NEWjQuery plugin for doing periodic execution
jQuery plugin for doing periodic execution
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.
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.
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 :)
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!
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.