diff options
author | Hayleigh Thompson <me@hayleigh.dev> | 2023-08-20 07:20:49 +0100 |
---|---|---|
committer | Hayleigh Thompson <me@hayleigh.dev> | 2023-08-20 07:20:49 +0100 |
commit | 00f258dc7a305fe683d473aa6c6e526fa0b68d9c (patch) | |
tree | 0521fa2c647127589e435724de031936226d5778 | |
parent | 88b71b747490f97d4e123e908e66f461ab122e4a (diff) | |
download | lustre-00f258dc7a305fe683d473aa6c6e526fa0b68d9c.tar.gz lustre-00f258dc7a305fe683d473aa6c6e526fa0b68d9c.zip |
:sparkles: Add a util for checking if a component name has already been registered.
-rw-r--r-- | lib/src/lustre.ffi.mjs | 1 | ||||
-rw-r--r-- | lib/src/lustre.gleam | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/src/lustre.ffi.mjs b/lib/src/lustre.ffi.mjs index b0f4661..10524e0 100644 --- a/lib/src/lustre.ffi.mjs +++ b/lib/src/lustre.ffi.mjs @@ -216,3 +216,4 @@ export const setup_component = ( // UTLS ------------------------------------------------------------------------ export const is_browser = () => window && window.document; +export const is_registered = (name) => !!customElements.get(name); diff --git a/lib/src/lustre.gleam b/lib/src/lustre.gleam index ec04f3e..2585a5b 100644 --- a/lib/src/lustre.gleam +++ b/lib/src/lustre.gleam @@ -253,3 +253,8 @@ pub fn start( pub fn is_browser() -> Bool { False } + +@external(javascript, "./lustre.ffi.mjs", "is_registered") +pub fn is_registered(_name: String) -> Bool { + False +} |