zh Kooboo Logo Documents

Concept

 

KScript is the term used for JavaScript running within Kooboo. KScript is compatible with ES6 and above, as well as TypeScript.
 
All In JavaScript
 
We have chosen JavaScript as the language for all programming tasks to achieve higher productivity. JavaScript is widely known and understood by most web developers, eliminating the need for additional learning. We have provided more detailed explanations on why we made this choice in the "Innovation" section.
 
 
Page Script
 
JavaScript can run in the backend, providing API data and more. In addition to that, we also allow Server Side JavaScript to run directly on the frontend pages. To run JavaScript at front page in the backend, simply add the env=server tag.
 
<script env="server">
    var text = "Hello World"; 
</script> 
<div>
    <h2 k-content="text">text</h2> 
</div>
 
The generated HTML code would not include the script tag, as it is intended for backend execution only.
 
<div>
    <h2>Hello World</h2> 
</div>
 
 
Extension Features
 
To enhance JavaScript's capabilities in the backend, we have added extensions under the k namespace. These extensions provide additional backend functionalities and intelligent code suggestions.
 
We will introduce the main libraries in the following sections.