Skip to content

Create context on subscribers #41

@CrochetFeve0251

Description

@CrochetFeve0251

Is your feature request related to a problem? Please describe.
Contexts are a great way in WP Rocket to decide whenever a callback is gonna execute or not.

Describe the solution you'd like
We would need that context into launchpad.

However, when adding them to Launchpad, we would like them to be instantiated apart from the subscriber.
That way we would be able to save save memory by just instantiating the context and bail out if without instantiating the subscriber if we don't need that logic.

Also, to simplify the logic to add a context and prevent repetitive code, we should be using annotations @context for that on the class or the method definition.

Priority should go on the method context if two contexts are registered.

Finally, for the context itself, to prevent any heavy constraints, it should just be a method or a class with php invoke method and without parameters.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions