What is Jet.js?

Jet.js is a lightweight javascript execution library. The name is an acronym from the previous mentioned description: javascript execution. It's designed to achieve high performance and to implement javascript functionality as progressive enhancement. It also helps to organize your scripts, because of its plugin oriented architecture. The focus is on plugin execution and not on building views. Thats why it is best suited to use with multi page sites and not with SPAs (Single Page Applications).

Declarative to start fast

Plugins that should be executed are defined directly inside your HTML Markup as a data attribute. Assume you would like to execute some logic developed as helloWorld Plugin, you can write the following:

<div data-plugins="helloWorld">...</div>

This approach removes the need from inline scripts, but gives you more control about the execution. Parameter can also be defined as data attributes. If the helloWorld Plugin above has a text option, we can defined it like this:

<div data-plugins="helloWorld" data-hello-world-text="Hello Jet.js World!">...</div>

This is very powerful if it comes to CMS integration. Because theses systems are good at content management and in combining and creating html snippets. Because of the declarative definition as data Attributes, Jet.js works with every Template Engine.

What if a user blocks Javascript? Then this approach can help you too. Because you start writing html and make it work, before you add any plugins. Afterfwards you add Plugins to add nice effects to provide a nice and smooth user experience. But if you keep these optional you provide a usable experience even for users without javascript enabled.

Don't blocks the main thread

Another key goal from Jet.js, is to never block the main thread. Jet.js itself provides a threadpool based on the WebWorker-API to offload the work. It is used to parse the plugin definitions. To provide a high performance at execution time its plugin architecture is build on top of reactive streams. And it makes it easy for developers to use the provided threadpool.