* Add a service to the extension currently being registered. This is a * restricted method and it's allowed to be called only during the overall * extension registration. * @param {string} name * @param {function(new:Object, !./ampdoc-impl.AmpDoc)} implementationClass
(name, implementationClass)
| 400 | * @param {function(new:Object, !./ampdoc-impl.AmpDoc)} implementationClass |
| 401 | */ |
| 402 | addService(name, implementationClass) { |
| 403 | const holder = this.getCurrentExtensionHolder_(name); |
| 404 | holder.extension.services.push( |
| 405 | /** @type {!ExtensionServiceDef} */ ({ |
| 406 | serviceName: name, |
| 407 | serviceClass: implementationClass, |
| 408 | }) |
| 409 | ); |
| 410 | this.addDocFactory((ampdoc) => { |
| 411 | registerServiceBuilderForDoc( |
| 412 | ampdoc, |
| 413 | name, |
| 414 | implementationClass, |
| 415 | /* instantiate */ true |
| 416 | ); |
| 417 | }); |
| 418 | } |
| 419 | |
| 420 | /** |
| 421 | * Add a ampdoc factory to the extension currently being registered. This is a |
no test coverage detected