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

Service Registration: Chunk #7880

Merged
merged 29 commits into from Mar 22, 2017

Conversation

kmh287
Copy link
Contributor

@kmh287 kmh287 commented Mar 1, 2017

This pull request distinguishes installing/registering the chunk service and creating it.Please see #7839 for more context.

/to @choumx @jridgewell

src/chunk.js Outdated
@@ -107,7 +123,7 @@ export function activateChunkingForTesting() {
* @param {!Node|!./service/ampdoc-impl.AmpDoc} nodeOrAmpDoc
*/
export function runChunksForTesting(nodeOrAmpDoc) {
const service = fromClassForDoc(nodeOrAmpDoc, 'chunk', Chunks);
const service = getChunkServiceForDoc_(nodeOrAmpDoc);

Choose a reason for hiding this comment

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

chunkInstanceForTesting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

src/chunk.js Outdated
* @param {!Node|!./service/ampdoc-impl.AmpDoc} nodeOrAmpDoc
* @return {!Chunks}
*/
function getChunkServiceForDoc_(nodeOrAmpDoc) {

Choose a reason for hiding this comment

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

You can remove this method if you register the service in startupChunk. Registering and retrieving a service in the same method still looks weird to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The function is called in three places. I'm not sure I see the value added by inlining it.

src/chunk.js Outdated
/**
* @param {!Node|!./service/ampdoc-impl.AmpDoc} nodeOrAmpDoc
*/
export function installChunkServiceForDoc_(nodeOrAmpDoc) {

Choose a reason for hiding this comment

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

Does this need to be exported? Note that trailing underscore is a naming convention for private props/functions.

If it's called in only one place, you probably don't need the method to start with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ampprojectbot
Copy link
Member

Hi, ampproject bot here! Here are a list of the owners that can approve your files.

You may leave an issue comment stating "@ampprojectbot retry!" to force me to re-evaluate this Pull Request's status

/to dvoytenko jridgewell

  • src/chunk.js

For any issues please file a bug at https://github.com/google/github-owners-bot/issues

@@ -37,6 +37,15 @@ let deactivated = /nochunking=1/.test(self.location.hash);
const resolved = Promise.resolve();

/**
* @param {!Node|!./service/ampdoc-impl.AmpDoc} nodeOrAmpDoc
* @return {!Chunks}

Choose a reason for hiding this comment

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

@private

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@kmh287 kmh287 force-pushed the service_registration15_chunk branch from 6a9631d to 9de9664 Compare March 17, 2017 18:43
@kmh287 kmh287 merged commit f15586c into ampproject:master Mar 22, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants