@compone/define
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -6,8 +6,9 @@ const classed = require('@compone/class') | ||
, HTMLElement = client ? window.HTMLElement : class {} | ||
, registry = client ? window.customElements : {} | ||
module.exports = function define(name, component) { | ||
if (arguments.length == 1) { component = name, name = `anon-${customElements.anon++}` } | ||
if (arguments.length == 1) { component = name, name = `anon-${registry.anon++}` } | ||
if (!name.includes('-')) return; | ||
if (!client) return wrap(classed(component)) | ||
let wrapped = customElements.get(name) | ||
let wrapped = registry.get(name) | ||
@@ -25,3 +26,3 @@ if (wrapped) { | ||
wrapped = wrap(classed(component)) | ||
customElements.define(name, wrapped) | ||
registry.define(name, wrapped) | ||
} | ||
@@ -69,2 +70,2 @@ | ||
customElements.anon = customElements.anon || 1 | ||
registry.anon = registry.anon || 1 |
{ | ||
"name": "@compone/define", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2466
57