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

Function assertService

src/element-service.js:149–162  ·  view source on GitHub ↗

* Throws user error if `service` is null. * @param {object} service * @param {string} id * @param {string} extension * @return {!Object} * @private * @closurePrimitive {asserts.matchesReturn}

(service, id, extension)

Source from the content-addressed store, hash-verified

147 * @closurePrimitive {asserts.matchesReturn}
148 */
149function assertService(service, id, extension) {
150 return /** @type {!Object} */ (
151 userAssert(
152 service,
153 'Service %s was requested to be provided through %s, ' +
154 'but %s is not loaded in the current page. To fix this ' +
155 'problem load the JavaScript file for %s in this page.',
156 id,
157 extension,
158 extension,
159 extension
160 )
161 );
162}
163
164/**
165 * Returns the promise for service with `id` on the given window if available.

Callers 1

getElementServiceForDocFunction · 0.85

Calls 1

userAssertFunction · 0.90

Tested by

no test coverage detected