Skip to content

Commit

Permalink
🐛 [Story devtools] Make players on layoutCallback so they load (#32136)
Browse files Browse the repository at this point in the history
* Make players on layoutCallback so they load

* Remove unused import
  • Loading branch information
mszylkowski committed Jan 25, 2021
1 parent 29e7615 commit cb907be
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ import {
import {closest} from '../../../src/dom';
import {escapeCssSelectorIdent} from '../../../src/css';
import {htmlFor} from '../../../src/static-template';
import {
observeContentSize,
unobserveContentSize,
} from '../../../src/utils/size-observer';
import {observeContentSize} from '../../../src/utils/size-observer';
import {setStyles} from '../../../src/style';

/**
Expand Down Expand Up @@ -430,26 +427,20 @@ export class AmpStoryDevToolsTabPreview extends AMP.BaseElement {
chipListContainer.appendChild(chipList);
chipListContainer.appendChild(this.buildAddDeviceButton_());
chipListContainer.appendChild(this.buildHelpButton_());
}

/** @override */
layoutCallback() {
parseDevices(
this.element.getAttribute('data-devices') || DEFAULT_DEVICES
).forEach((device) => {
this.addDevice_(device.name);
});
this.repositionDevices_();
}

/** @override */
layoutCallback() {
this.element.addEventListener('click', (e) => this.handleTap_(e.target));
observeContentSize(this.element, this.onResize_);
}

/** @override */
unlayoutCallback() {
unobserveContentSize(this.element, this.onResize_);
}

/**
* Builds the add device button
* @private
Expand Down

0 comments on commit cb907be

Please sign in to comment.