From 927b34ace6f078a99f83593ba3eefcfce05f3088 Mon Sep 17 00:00:00 2001 From: ikonnikov Date: Tue, 24 Mar 2020 22:20:24 +0300 Subject: [PATCH] Add new public method setPeriod for change the period after start. --- jquery.periodic.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/jquery.periodic.js b/jquery.periodic.js index dc7e8c4..9f680d1 100755 --- a/jquery.periodic.js +++ b/jquery.periodic.js @@ -19,7 +19,8 @@ jQuery.periodic = function (options, callback) { ajax_complete : ajaxComplete, increment : increment, reset : reset, - cancel : cancel + cancel : cancel, + setPeriod : setPeriod }, options); // bookkeeping variables @@ -84,6 +85,11 @@ jQuery.periodic = function (options, callback) { clearTimeout(settings.tid); settings.tid = null; } + + function setPeriod(new_period) { + settings.period = new_period; + reset(); + } // other functions we might want to implement function pause() {}