MCPcopy
hub / github.com/ampproject/amphtml / close

Method close

third_party/subscriptions-project/swg.js:10973–11000  ·  view source on GitHub ↗

* Closes the dialog. * @param {boolean=} animated * @return {!Promise}

(animated = true)

Source from the content-addressed store, hash-verified

10971 * @return {!Promise}
10972 */
10973 close(animated = true) {
10974 let animating;
10975 if (animated) {
10976 const transitionStyles = this.shouldPositionCenter_()
10977 ? {'opacity': 0}
10978 : {'transform': 'translateY(100%)'};
10979
10980 animating = this.animate_(() => {
10981 this.graypane_.hide(/* animate */ true);
10982 return transition$1(this.getElement(), transitionStyles, 300, 'ease-out');
10983 });
10984 } else {
10985 animating = Promise.resolve();
10986 }
10987
10988 this.doc_.getBody().classList.remove('swg-disable-scroll');
10989
10990 return animating.then(() => {
10991 const iframeEl = this.iframe_.getElement();
10992 iframeEl.parentNode.removeChild(iframeEl);
10993
10994 this.removePaddingToHtml_();
10995 this.graypane_.destroy();
10996 if (this.desktopMediaQueryListener_) {
10997 this.desktopMediaQuery_.removeListener(this.desktopMediaQueryListener_);
10998 }
10999 });
11000 }
11001
11002 /**
11003 * Gets the container within the dialog.

Callers

nothing calls this directly

Calls 12

shouldPositionCenter_Method · 0.95
animate_Method · 0.95
getElementMethod · 0.95
removePaddingToHtml_Method · 0.95
transition$1Function · 0.85
resolveMethod · 0.80
hideMethod · 0.45
removeMethod · 0.45
getBodyMethod · 0.45
thenMethod · 0.45
getElementMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected