Skip to content

Commit

Permalink
privatify
Browse files Browse the repository at this point in the history
  • Loading branch information
samouri committed Jan 10, 2020
1 parent 95f983c commit f9d4168
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions extensions/amp-list/0.1/amp-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,9 @@ export class AmpList extends AMP.BaseElement {
*
* @param {string} src
* @return {boolean}
* @private
*/
isAmpStateSrc(src) {
isAmpStateSrc_(src) {
return (
isExperimentOn(this.win, 'amp-list-init-from-state') &&
startsWith(src, 'amp-state:')
Expand All @@ -359,8 +360,9 @@ export class AmpList extends AMP.BaseElement {
/**
* @param {!Array|!Object|string} src
* @return {!Promise}
* @private
*/
renderLocalData(src) {
renderLocalData_(src) {
let dataPromise;
if (typeof src === 'string') {
const ampStatePath = src.substring('amp-state:'.length);
Expand Down Expand Up @@ -411,8 +413,8 @@ export class AmpList extends AMP.BaseElement {
const src = mutations['src'];
const state = /** @type {!JsonObject} */ (mutations)['state'];
if (src !== undefined) {
if (typeof src === 'object' || this.isAmpStateSrc(src)) {
promise = this.renderLocalData(/** @type {!Object} */ (src));
if (typeof src === 'object' || this.isAmpStateSrc_(src)) {
promise = this.renderLocalData_(/** @type {!Object} */ (src));
} else if (typeof src === 'string') {
// Defer to fetch in layoutCallback() before first layout.
if (this.layoutCompleted_) {
Expand All @@ -424,7 +426,7 @@ export class AmpList extends AMP.BaseElement {
}
} else if (state !== undefined) {
user().error(TAG, '[state] is deprecated, please use [src] instead.');
promise = this.renderLocalData(state);
promise = this.renderLocalData_(state);
}

const isLayoutContainer = mutations['is-layout-container'];
Expand Down Expand Up @@ -600,8 +602,8 @@ export class AmpList extends AMP.BaseElement {
const elementSrc = this.element.getAttribute('src');
if (!elementSrc) {
return Promise.resolve();
} else if (this.isAmpStateSrc(elementSrc)) {
return this.renderLocalData(elementSrc);
} else if (this.isAmpStateSrc_(elementSrc)) {
return this.renderLocalData_(elementSrc);
}

let fetch;
Expand Down

0 comments on commit f9d4168

Please sign in to comment.