I'm intrigued by this project and toyed with creating something similar in the past. I'm wondering how strategy in the handler actually works. like in this example:
https://github.com/x-wp/di/blob/master/examples/simple-plugin/src/WC/Handlers/Product_Page_Handler.php#L24
#[Handler(
tag: 'init',
priority: 10,
context: Handler::CTX_FRONTEND,
strategy: Handler::INIT_JUST_IN_TIME,
container: 'example',
)]
class Product_Page_Handler {
Would Handler::INIT_JUST_IN_TIME prevent the Product_Page_Handler class from being loaded until the 'woocommerce_single_product_summary' or 'woocommerce_before_add_to_cart' actions are called?
I want to avoid loading large classes with potentially long init steps unless they are actually used. is INIT_JUST_IN_TIME the only way to do this? What are the other strategies.
I'm intrigued by this project and toyed with creating something similar in the past. I'm wondering how strategy in the handler actually works. like in this example:
https://github.com/x-wp/di/blob/master/examples/simple-plugin/src/WC/Handlers/Product_Page_Handler.php#L24
Would
Handler::INIT_JUST_IN_TIMEprevent the Product_Page_Handler class from being loaded until the 'woocommerce_single_product_summary' or 'woocommerce_before_add_to_cart' actions are called?I want to avoid loading large classes with potentially long init steps unless they are actually used. is INIT_JUST_IN_TIME the only way to do this? What are the other strategies.