As many of you know, I’m a big fan of the K.I.S.S. principle — keep things simple and short. That idea has always guided Jet, so I decided it was time to make component syntax even smaller and faster to write.
I added aliases for the most used component properties. To be honest, even I got tired of typing name every time when one letter can do the same job.
You can still use the full property names if that feels clearer or easier to remember. They are fully supported and stay for backward compatibility. But the short aliases are now the main syntax inside Jet.
The good news is that the aliases are easy to learn, because most of them are simply the first letter of the original property name.
Main Aliases
- name → n
- data → d
- tpl → t
- methods → f
- watch → w
- mount → m
Most aliases use the first letter, with one small exception: methods.
Both methods and mount start with m, so I needed another option. I briefly thought about using something unusual, but finally chose f, because methods are really functions. It also feels comfortable on the keyboard, which is a nice bonus when coding a lot.
Legacy Syntax Still Works
jet({
name: "com-hello",
data: { text: "Hello World" },
tpl: `
{text}
`, methods: { sayHi() { console.log(“Hi!”); } }, mount() { console.log(“Mounted”); } });
New Short Syntax
pt" tabindex="0">
jet({
n: "com-hello",
d: { text: "Hello World" },
t: `
{text}
`, fs: { sayHi() { console.log("Hi!"); } }, mount() { console.log("Mounted"); } });