New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract signals into its own class #7240
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was going to suggest this :)
* This object tracts signals and allows blocking until a signal has been | ||
* received. | ||
*/ | ||
export class Signals { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An extra object allocation per element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the cost of being able to track past events that maybe requested in the future. Can't see another option, tbh. But would be happy to discuss.
This is fine. Do we currently need signals on all elements? Or could elements opt-in? |
@cramforce We are now using it for built signals and all elements build. There's no way to make it more selective and creating |
The
Signals
object is used across AMP elements, ampdoc and friendly embeds and potentially more in the future. Signals can be used for analytics or other dependent functions.This PR is a straightforward refactoring that extracts
Signals
class and its tests into a separate module. No functional code changes.