And inside your view in head tag you will need to write:
<!DOCTYPE html> <head> <meta charset="utf-8"> <title> Admin </title> <?php echo $js ?> </head> <body> ...
console.log(preload); console.log(preload.user); console.log(preload.basePath);
But If you want to use some other window variable name, for example config, you can type:
<?php echo $js("config") ?>
This will export data to window.config variable. Awesome!