Skip to content

Commit

Permalink
whenBuild -> build
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Voytenko committed Feb 23, 2021
1 parent d79a5e7 commit 1bc63ef
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions builtins/amp-img.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ export class AmpImg extends BaseElement {
/** @override */
unlayoutCallback() {
if (AmpImg.V1()) {
// TODO(#31915): Reconsider if this is still desired for V1. This helps
// with network interruption when a document is inactivated.
return;
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-auto-ads/0.1/placement.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export class Placement {
return (
whenUpgradedToCustomElement(this.getAdElement())
// Responsive ads set their own size when built.
.then(() => this.getAdElement().whenBuilt())
.then(() => this.getAdElement().build())
.then(() => {
const resized = !this.getAdElement().classList.contains(
'i-amphtml-layout-awaiting-size'
Expand All @@ -231,7 +231,7 @@ export class Placement {
// synchronously. So we explicitly wait for CustomElement to be
// ready.
return whenUpgradedToCustomElement(this.getAdElement())
.then(() => this.getAdElement().whenBuilt())
.then(() => this.getAdElement().build())
.then(() => {
return this.mutator_.requestChangeSize(
this.getAdElement(),
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-consent/0.1/consent-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export class ConsentUI {
// at build time. (see #18841).
if (isAmpElement(this.ui_)) {
whenUpgradedToCustomElement(this.ui_)
.then(() => this.ui_.whenBuilt())
.then(() => this.ui_.build())
.then(() => show());
} else {
show();
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-form/0.1/amp-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export class AmpForm {
EXTERNAL_DEPS.join(',')
);
// Wait for an element to be built to make sure it is ready.
const promises = toArray(depElements).map((el) => el.whenBuilt());
const promises = toArray(depElements).map((el) => el.build());
return (this.dependenciesPromise_ = this.waitOnPromisesOrTimeout_(
promises,
2000
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-sticky-ad/1.0/amp-sticky-ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class AmpStickyAd extends AMP.BaseElement {
dev().assertElement(this.ad_)
)
.then((ad) => {
return ad.whenBuilt();
return ad.build();
})
.then(() => {
return this.mutateElement(() => {
Expand Down Expand Up @@ -188,7 +188,7 @@ class AmpStickyAd extends AMP.BaseElement {
*/
scheduleLayoutForAd_() {
whenUpgradedToCustomElement(dev().assertElement(this.ad_)).then((ad) => {
ad.whenBuilt().then(this.layoutAd_.bind(this));
ad.build().then(this.layoutAd_.bind(this));
});
}

Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-story/1.0/amp-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ export class AmpStory extends AMP.BaseElement {
);
if (!this.getAmpDoc().hasBeenVisible()) {
return whenUpgradedToCustomElement(initialPageEl).then(() => {
return initialPageEl.whenBuilt();
return initialPageEl.build();
});
}

Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-story/1.0/page-advancement.js
Original file line number Diff line number Diff line change
Expand Up @@ -1011,8 +1011,8 @@ export class MediaBasedAdvancement extends AdvancementConfig {
super.start();

// Prevents race condition when checking for video interface classname.
(this.element_.whenBuilt
? this.element_.whenBuilt()
(this.element_.build
? this.element_.build()
: Promise.resolve()
).then(() => this.startWhenBuilt_());
}
Expand Down

0 comments on commit 1bc63ef

Please sign in to comment.