Skip to content
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

Merged
merged 1 commit into from Jan 30, 2017

Conversation

dvoytenko
Copy link
Contributor

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.

Copy link
Member

@cramforce cramforce left a 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 {
Copy link
Member

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.

Copy link
Contributor Author

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.

@cramforce
Copy link
Member

This is fine. Do we currently need signals on all elements? Or could elements opt-in?

@dvoytenko
Copy link
Contributor Author

@cramforce We are now using it for built signals and all elements build. There's no way to make it more selective and creating Signals is probably cheaper than creating lots of promises - the part where signals is fairly efficient.

@dvoytenko dvoytenko merged commit 87b2dc4 into ampproject:master Jan 30, 2017
@dvoytenko dvoytenko deleted the fie14-signals2 branch January 30, 2017 18:29
jridgewell pushed a commit to jridgewell/amphtml that referenced this pull request Jan 31, 2017
torch2424 pushed a commit to torch2424/amphtml that referenced this pull request Feb 14, 2017
mrjoro pushed a commit to mrjoro/amphtml that referenced this pull request Apr 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants