Skip to content

Commit

Permalink
Création de la fonction pour débogage PlxUtils::debugJS(..)
Browse files Browse the repository at this point in the history
  • Loading branch information
bazooka07 committed Dec 4, 2017
1 parent 8786494 commit be1098f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/lib/class.plx.utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1062,5 +1062,23 @@ public static function debug($obj) {
echo $obj;
echo "</pre>";
}

/**
* Envoie un message vers la console javascript pour aider au déboggage.
* @author J.P. Pourrez alias bazooka07
* @version 2017-06-09
* */
public static function debugJS($obj, $msg='') {

if(!empty($msg)) $msg .= ' = ';
$msg .= (is_array($obj)) ? print_r($obj, true) : ((is_string($obj)) ? "\"$obj\"" : $obj);
echo <<< EOT
<script type="text/javascript">
console.log(`$msg`);
</script>
EOT;
}

}
?>

0 comments on commit be1098f

Please sign in to comment.