MCPcopy Create free account
hub / github.com/ampproject/amphtml / define

Method define

src/polyfills/custom-elements.js:114–125  ·  view source on GitHub ↗

* Register the custom element. * * @param {string} name * @param {!CustomElementConstructorDef} ctor * @param {!Object=} options

(name, ctor, options)

Source from the content-addressed store, hash-verified

112 * @param {!Object=} options
113 */
114 define(name, ctor, options) {
115 this.registry_.define(name, ctor, options);
116
117 // If anyone is waiting for this custom element to be defined, resolve
118 // their promise.
119 const pending = this.pendingDefines_;
120 const deferred = pending[name];
121 if (deferred) {
122 deferred.resolve();
123 delete pending[name];
124 }
125 }
126
127 /**
128 * Get the constructor of the (already defined) custom element.

Callers

nothing calls this directly

Calls 2

resolveMethod · 0.80
defineMethod · 0.45

Tested by

no test coverage detected