PluginProbe
Web Worker Offloading / 0.2.1
Web Worker Offloading v0.2.1
trunk 0.1.0 0.1.1 0.2.0 0.2.1 0.3.0
web-worker-offloading / load.php

load.php in Web Worker Offloading 0.2.1, at load.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Web Worker Offloading
4 * Plugin URI: https://github.com/WordPress/performance/issues/176
5 * Description: Offloads select JavaScript execution to a Web Worker to reduce work on the main thread and improve the Interaction to Next Paint (INP) metric.
6 * Requires at least: 6.6
7 * Requires PHP: 7.2
8 * Version: 0.2.1
9 * Author: WordPress Performance Team
10 * Author URI: https://make.wordpress.org/performance/
11 * License: GPLv2 or later
12 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13 * Text Domain: web-worker-offloading
14 *
15 * @package web-worker-offloading
16 */
17
18 // @codeCoverageIgnoreStart
19 if ( ! defined( 'ABSPATH' ) ) {
20 exit; // Exit if accessed directly.
21 }
22
23 // Define the constant.
24 if ( defined( 'WEB_WORKER_OFFLOADING_VERSION' ) ) {
25 return;
26 }
27
28 if (
29 ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) &&
30 ! file_exists( __DIR__ . '/build/partytown.asset.php' )
31 ) {
32 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
33 trigger_error(
34 esc_html(
35 sprintf(
36 /* translators: 1: File path. 2: CLI command. */
37 '[Web Worker Offloading] ' . __( 'Unable to load %1$s. Please make sure you have run %2$s.', 'web-worker-offloading' ),
38 'build/partytown.asset.php',
39 '`npm install && npm run build:plugin:web-worker-offloading`'
40 )
41 ),
42 E_USER_ERROR
43 );
44 }
45
46 define( 'WEB_WORKER_OFFLOADING_VERSION', '0.2.1' );
47
48 require_once __DIR__ . '/helper.php';
49 require_once __DIR__ . '/hooks.php';
50 require_once __DIR__ . '/third-party.php';
51 // @codeCoverageIgnoreEnd
52