* Resolves the value via geo service. * @param {function(!../../extensions/amp-geo/0.1/amp-geo.GeoDef)} getter * @param {string} expr * @return {!Promise<{[key: string]: (string|Array >} * @template T * @private
(getter, expr)
| 782 | * @private |
| 783 | */ |
| 784 | getGeo_(getter, expr) { |
| 785 | if (this.cachedGeo_ !== null) { |
| 786 | return getter(this.cachedGeo_); |
| 787 | } |
| 788 | |
| 789 | return Services.geoForDocOrNull(this.ampdoc.getHeadNode()).then((geo) => { |
| 790 | userAssert(geo, 'To use variable %s, amp-geo should be configured', expr); |
| 791 | this.cachedGeo_ = geo; |
| 792 | return getter(geo); |
| 793 | }); |
| 794 | } |
| 795 | |
| 796 | /** |
| 797 | * Returns cached uach signal if available, calculate it if not. |
no test coverage detected