MCPcopy
hub / github.com/fengyuanchen/cropperjs / $define

Method $define

packages/element/src/index.ts:283–301  ·  view source on GitHub ↗

* Defines the constructor as a new custom element. * https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define * @param {string|object} [name] The element name. * @param {object} [options] The element definition options.

(
    name?: string | ElementDefinitionOptions,
    options?: ElementDefinitionOptions,
  )

Source from the content-addressed store, hash-verified

281 * @param {object} [options] The element definition options.
282 */
283 static $define(
284 name?: string | ElementDefinitionOptions,
285 options?: ElementDefinitionOptions,
286 ): void {
287 if (isObject(name)) {
288 options = name;
289 name = '';
290 }
291
292 if (!name) {
293 name = this.$name || this.name;
294 }
295
296 name = toKebabCase(name as string);
297
298 if (IS_BROWSER && WINDOW.customElements && !WINDOW.customElements.get(name)) {
299 customElements.define(name, this, options);
300 }
301 }
302}

Callers 10

index.spec.tsFile · 0.80
index.spec.tsFile · 0.80
index.spec.tsFile · 0.80
index.spec.tsFile · 0.80
index.spec.tsFile · 0.80
index.spec.tsFile · 0.80
index.spec.tsFile · 0.80
index.spec.tsFile · 0.80
index.tsFile · 0.80
index.spec.tsFile · 0.80

Calls 3

isObjectFunction · 0.90
toKebabCaseFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected