Skip to content

Commit 89eac85

Browse files
committed
execAtLast method
1 parent cfc18cf commit 89eac85

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Ajax/JsUtils.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ public function compile(&$view=NULL, $view_var='script_foot', $script_tags=TRUE)
230230
return;
231231
}
232232

233+
$this->jquery_code_for_compile=\array_merge($this->jquery_code_for_compile,$this->jquery_code_for_compile_at_last);
234+
233235
// Inline references
234236
$script=$this->ready(implode('', $this->jquery_code_for_compile));
235237
if($this->params["defer"]){

Ajax/common/traits/JsUtilsActionsTrait.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/**
88
* @author jc
99
* @property array $jquery_code_for_compile
10+
* @property array $jquery_code_for_compile_at_last
1011
*/
1112
trait JsUtilsActionsTrait {
1213

@@ -500,6 +501,18 @@ public function exec($js, $immediatly=false) {
500501
return $script;
501502
}
502503

504+
/**
505+
* Executes the code $js
506+
* @param string $js Code to execute
507+
* @param boolean $immediatly delayed if false
508+
* @return String
509+
*/
510+
public function execAtLast($js) {
511+
$script=$js."\n";
512+
$this->jquery_code_for_compile_at_last[]=$script;
513+
return $script;
514+
}
515+
503516
/**
504517
* Executes the javascript code $js when $event fires on $element
505518
* @param string $event

Ajax/common/traits/JsUtilsInternalTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
trait JsUtilsInternalTrait{
66

77
protected $jquery_code_for_compile=array ();
8+
protected $jquery_code_for_compile_at_last=array ();
89

910
protected function _addToCompile($jsScript) {
1011
$this->jquery_code_for_compile[]=$jsScript;

0 commit comments

Comments
 (0)