MCPcopy
hub / github.com/ampproject/amphtml / getServiceForDocOrNull

Function getServiceForDocOrNull

src/service-helpers.js:216–224  ·  view source on GitHub ↗
(elementOrAmpDoc, id)

Source from the content-addressed store, hash-verified

214 * @return {?Object}
215 */
216export function getServiceForDocOrNull(elementOrAmpDoc, id) {
217 const ampdoc = getAmpdoc(elementOrAmpDoc);
218 const holder = getAmpdocServiceHolder(ampdoc);
219 if (isServiceRegistered(holder, id)) {
220 return getServiceInternal(holder, id);
221 } else {
222 return null;
223 }
224}
225
226/**
227 * Returns a promise for a service for the given id and ampdoc. Also expects

Callers 5

test-service.jsFile · 0.90
index.jsFile · 0.90
executeInvocation_Method · 0.90

Calls 4

getAmpdocFunction · 0.85
getAmpdocServiceHolderFunction · 0.85
isServiceRegisteredFunction · 0.85
getServiceInternalFunction · 0.85

Tested by

no test coverage detected