-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
# Elm-like API sample
This page is a one approach of creating API layer top of ef.js.
## Considerations
### Bundle size or runtime performance
If you going to use this API style, you'll face a trade-off between increased bundle size and function call overhead.
By defining everything as separated functions, there is virtually zero runtime overhead but bundle size would definitely increases.
```ts
import { el } from "@pocka/ef";
export function div(setups = [], children = []) {
return el("div", setups, children);
}
export const p = el.bind(null, "p");
// Enumerate every HTML/SVG/MathML tag...
```
On the other hand, using `Proxy` object like in this page, would bring performance penalty on every function call, although you can avoid this cost by declaring each tag as a function eagerly (see `main.ts`).
You need to choose based on which approach is best suitable for your project.