Automattic\WooCommerce\Blocks\Assets
Api::__construct()
Constructor for class
Method of the class: Api{}
No Hooks.
Return
null
. Nothing (null).
Usage
$Api = new Api(); $Api->__construct( $package );
- $package(Package) (required)
- An instance of Package.
Api::__construct() Api:: construct code WC 9.8.2
public function __construct( Package $package ) { // Use wc- prefix here to prevent collisions when WC Core version catches up to a version previously used by the WC Blocks feature plugin. $this->wc_version = 'wc-' . Constants::get_constant( 'WC_VERSION' ); $this->package = $package; $this->disable_cache = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) || wp_get_environment_type() !== 'production'; // If the site is accessed via HTTPS, change the transient key. This is to prevent the script URLs being cached // with the first scheme they are accessed on after cache expiry. if ( is_ssl() ) { $this->script_data_transient_key .= '_ssl'; } if ( ! $this->disable_cache ) { $this->script_data_hash = $this->get_script_data_hash(); } add_action( 'shutdown', array( $this, 'update_script_data_cache' ), 20 ); }