* Requests the resource's element to be built. See AmpElement.build * for details. * @return {?Promise}
()
| 321 | * @return {?Promise} |
| 322 | */ |
| 323 | build() { |
| 324 | if (this.isBuilding_ || !this.element.isUpgraded()) { |
| 325 | return null; |
| 326 | } |
| 327 | this.isBuilding_ = true; |
| 328 | return this.element.buildInternal().then( |
| 329 | () => { |
| 330 | this.isBuilding_ = false; |
| 331 | this.state_ = ResourceState_Enum.NOT_LAID_OUT; |
| 332 | // TODO(dvoytenko): merge with the standard BUILT signal. |
| 333 | this.element.signals().signal('res-built'); |
| 334 | }, |
| 335 | (reason) => { |
| 336 | this.maybeReportErrorOnBuildFailure(reason); |
| 337 | this.isBuilding_ = false; |
| 338 | this.element.signals().rejectSignal('res-built', reason); |
| 339 | throw reason; |
| 340 | } |
| 341 | ); |
| 342 | } |
| 343 | |
| 344 | /** |
| 345 | * @param {*} reason |
no test coverage detected