mirror of
https://github.com/MercuryWorkshop/dreamlandjs.git
synced 2025-05-16 07:30:01 -04:00
remove h useless hack
This commit is contained in:
parent
6cd1e1f304
commit
eb6ee2cb8c
3 changed files with 5 additions and 20 deletions
19
AliceJS.js
19
AliceJS.js
|
@ -127,25 +127,8 @@ export function useValue(references) {
|
|||
return reference.proxy[reference.property];
|
||||
}
|
||||
|
||||
// Hack to skip use() when there's only one possible property
|
||||
Object.defineProperty(window, "h", {
|
||||
get: () => {
|
||||
__reference_stack = [];
|
||||
return (type, props, ...children) => {
|
||||
let references = __reference_stack;
|
||||
references[ALICEJS_REFERENCES_MARKER] = true;
|
||||
|
||||
if (references.length == 1 && children.length == 1) {
|
||||
__reference_stack = [];
|
||||
return h(type, props, references);
|
||||
} else {
|
||||
return h(type, props, ...children);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
// Actual JSX factory. Responsible for creating the HTML elements and all of the *reactive* syntactic sugar
|
||||
function h(type, props, ...children) {
|
||||
export function h(type, props, ...children) {
|
||||
if (typeof type === "function") {
|
||||
let newthis = stateful({});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue