Skip to content

Commit 92f62c8

Browse files
committed
Adds comments on interval method
1 parent 23a6cb8 commit 92f62c8

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Ajax/common/traits/JsUtilsActionsTrait.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,14 @@ public function asDropZone($element,$jsCallback="",$parameters=[]){
573573
return $script;
574574
}
575575

576+
/**
577+
* Calls a function or evaluates an expression at specified intervals (in milliseconds)
578+
* @param string $jsCode The code to execute
579+
* @param int $time The time interval in milliseconds
580+
* @param string $globalName The global name of the interval, used to clear it
581+
* @param boolean $immediatly delayed if false
582+
* @return string
583+
*/
576584
public function interval($jsCode,$time,$globalName=null,$immediatly=true){
577585
if(!Javascript::isFunction($jsCode)){
578586
$jsCode="function(){\n".$jsCode."\n}";
@@ -585,6 +593,12 @@ public function interval($jsCode,$time,$globalName=null,$immediatly=true){
585593
return $this->exec($script,$immediatly);
586594
}
587595

596+
/**
597+
* Clears an existing interval
598+
* @param string $globalName The interval global name
599+
* @param boolean $immediatly delayed if false
600+
* @return string
601+
*/
588602
public function clearInterval($globalName,$immediatly=true){
589603
return $this->exec("if(window.{$globalName}){clearInterval(window.{$globalName});}",$immediatly);
590604
}

Ajax/common/traits/JsUtilsAjaxTrait.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ public function ajax($method,$url, $responseElement="", $parameters=[]) {
230230
return $this->_ajax($method,$url,$responseElement,$parameters);
231231
}
232232

233+
/**
234+
* @param string $method The http method (post, get...)
235+
* @param string $url The url of the request
236+
* @param int $interval The interval in milliseconds
237+
* @param string $globalName The interval name, for clear it
238+
* @param string $responseElement
239+
* @param array $parameters The ajax parameters, default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxLoader"=>null,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null,"historize"=>false)
240+
* @return string
241+
*/
233242
public function ajaxInterval($method,$url, $interval,$globalName=null,$responseElement="", $parameters=[]){
234243
return $this->interval($this->ajaxDeferred($method, $url,$responseElement,$parameters), $interval,$globalName);
235244
}

0 commit comments

Comments
 (0)