Finally, after two years of hard work, Layr v2 is out.
Actually, Layr v2 was published on NPM a year ago, but I haven't announced it because I needed to achieve three important things:
- Documented the new features.
- Created a CLI for Layr, which turned out to be a companion tool called Boostr.
- Rewrote the "Hello, World" tutorial and updated all the app examples.
That's all done, and I can now officially announce the release of Layr v2. However, as I will explain later, you may never use it.
Please check out my previous article if you've never heard of Layr.
Here are the most notable new features in Layr v2.
Attribute sanitization: When you assign a new value to an attribute, this value can be automatically sanitized with some built-in (e.g.,
trim()) or custom sanitization functions.
Attribute value assignment: You can now change the value of multiple attributes at once thanks to the component
assign()class and instance methods.
Method scheduling: Class methods have a new
scheduleoption to specify that a class method should be repeatedly called with a fixed time delay between each call.
Method queuing: Class and instance methods have a new
queueoption to specify that a method should be executed in the background.
- Wrappers: A wrapper can be associated with a component class or instance method to wrap any method associated with a route using this wrapper. Thanks to wrappers, you can, for example, easily nest your pages into layouts.
- Component instance routes: Before, routes could only be associated with component class methods. Now, you can associate routes with component instance methods as well.
Catch-all routes: You can now suffix a route URL pattern with a wildcard (
'*') to define a route that will be used when no other routes match the current URL. A typical use case is to define a route for displaying a "Not found" page.
page(): A decorator that combines the
layout(): A decorator that combines the
useData(): A hook for loading data asynchronously and rendering a React element using these data.
useAction(): A hook for executing some asynchronous actions.
Layr got a companion tool called Boostr for taking care of everything you need to build and deploy your apps.
You can check out the revised "Hello, World" tutorial to see Boostr in action.
Layr v2 includes some breaking changes that I will not describe here because, to my knowledge, nobody (except me) has built apps with Layr v1 for production use. Please let me know if it's not the case.
Some work remains to be done in the documentation:
- Some additional tutorials to cover all the basic features of Layr.
- A "Concepts" section to introduce the fundamental concepts behind Layr.
- A "Guides" section to explain how the most common features of an app could be implemented with Layr.
Unfortunately, writing documentation takes a lot of time, and the Layr project is currently only handled by me, who has to work for customers to make a living and is also starting a new ambitious project called 1Place, which will be based on Layr.
I need to raise money for 1Place, and if everything goes well, I should be able to hire talents to work on 1Place, and, indirectly, fuel the development of Layr.
Also, to build 1Place, some critical features should be added to Layr, such as component subscription and polymorphic storage, which will probably lead to additional breaking changes and a v3 release.
In the current situation, the future of Layr depends on 1Place. If 1Place fails, I'm certainly not going to give up on Layr, which I really care about, but its development will likely be slowed down.
So, for all these reasons, unless you feel very adventurous, I can't recommend building your next app with Layr v2 today.
You may wonder why I am announcing a new version while telling you not to use it. Well, I just felt I had to keep the few people who follow Layr's development informed.