diff options
author | Aylur <[email protected]> | 2024-10-09 02:52:02 +0000 |
---|---|---|
committer | Aylur <[email protected]> | 2024-10-09 02:52:02 +0000 |
commit | 2fa83eb09047e603835c462ff0d8a04eba016807 (patch) | |
tree | 9d5dbcd0b00cc390f5a9c5b1c699f50f4f8d304d /core/gjs/src/jsx | |
parent | f294fd8265873eae343d73fe4d83047387e4bf79 (diff) |
gjs: refactor widgets into classes
Diffstat (limited to 'core/gjs/src/jsx')
-rw-r--r-- | core/gjs/src/jsx/jsx-runtime.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/gjs/src/jsx/jsx-runtime.ts b/core/gjs/src/jsx/jsx-runtime.ts index cffcb76..f40dc05 100644 --- a/core/gjs/src/jsx/jsx-runtime.ts +++ b/core/gjs/src/jsx/jsx-runtime.ts @@ -16,14 +16,15 @@ export function jsx( children = children.filter(Boolean) - if (typeof ctor === "string") - return (ctors as any)[ctor](props, children) - if (children.length === 1) props.child = children[0] else if (children.length > 1) props.children = children + if (typeof ctor === "string") { + return new ctors[ctor](props) + } + if (isArrowFunction(ctor)) return ctor(props) |