PHP code example of hryvinskyi / magento2-deferjs
1. Go to this page and download the library: Download hryvinskyi/magento2-deferjs library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hryvinskyi / magento2-deferjs example snippets
declare(strict_types=1);
namespace Vendor\Module\Model\PassesValidator\Validators;
use Hryvinskyi\DeferJs\Model\PassesValidator\ValidatorInterface;
use Magento\Framework\App\Response\Http;
/**
* Class YourValidator
*/
class YourValidator implements ValidatorInterface
{
/**
* Validator function, handle javascript or not
*
* @param string $script
* @param Http $http
*
* @return bool
*/
public function validate(string $script, Http $http): bool
{
// Your code validate
}
}