| 1 |
<?php |
| 2 |
/** |
| 3 |
* Jetpack shared stores assets. |
| 4 |
* |
| 5 |
* @package automattic/jetpack-assets |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Automattic\Jetpack\Assets; |
| 9 |
|
| 10 |
use Automattic\Jetpack\Assets; |
| 11 |
|
| 12 |
/** |
| 13 |
* Registers the externalized jetpack-shared-stores bundle so that consuming |
| 14 |
* packages can declare it as a WordPress script dependency. Loading the bundle |
| 15 |
* once ensures the contained data stores register exactly once per page. |
| 16 |
*/ |
| 17 |
class Shared_Stores_Assets { |
| 18 |
|
| 19 |
const SCRIPT_HANDLE = 'jetpack-shared-stores'; |
| 20 |
|
| 21 |
/** |
| 22 |
* Configure. |
| 23 |
*/ |
| 24 |
public static function configure() { |
| 25 |
add_action( 'wp_loaded', array( self::class, 'register_assets' ) ); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Register assets. |
| 30 |
*/ |
| 31 |
public static function register_assets() { |
| 32 |
Assets::register_script( |
| 33 |
self::SCRIPT_HANDLE, |
| 34 |
'../build/jetpack-shared-stores.js', |
| 35 |
__FILE__, |
| 36 |
array( |
| 37 |
'in_footer' => true, |
| 38 |
) |
| 39 |
); |
| 40 |
} |
| 41 |
} |
| 42 |
|