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

Implement a page view id. #977

Merged
merged 1 commit into from
Dec 1, 2015
Merged

Conversation

cramforce
Copy link
Member

The id is relatively likely to be unique per page load, URL and user.

Fixes page view id part of #969

@cramforce
Copy link
Member Author

Fixed test



/**
* This class replaces substitution variables with their values.
*/
export class UrlReplacements {
class UrlReplacements {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were two reasons why I exported the class:

  1. Avi was saying that he wanted to customize url replacements for analytics that only applied there.
  2. I wanted to keep it extensible for amp-list for infinite scroll. E.g. "https://service/list.json?page=PAGE", where a hypothetical "PAGE" var would only be available in the context of amp-list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do it when we get there. For now a service seems a natural fit here. I think for other use cases, just replacing the raw replacement functionality might be better than inheritance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been intended as composition, not inheritance. If we proceed as a singleton, let's hide "set" method.

@dvoytenko
Copy link
Contributor

LGTM once set method is removed/hidden.

The id is relatively likely to be unique per page load, URL and
user.

1/2 of ampproject#969
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.

2 participants