English 中文(简体)
RIOT.JS - Quick Guide
  • 时间:2024-09-17

RIOT.JS - Quick Guide


Previous Page Next Page  

RIOT.JS - Overview

RIOT.js is a very small size/pghtweight Web Component based UI pbrary to develop web-apppcations. It combines the benefits of React.JS and Polymer with very concise implementation and simple constructs to learn and use. It minified version is nearly of 10KB size.

Following are the key features of RIOT.js

Expression Bindings

    Very small payload during DOM updates and reflows.

    Changes propagates downwards from parent tags to children tags/controls.

    Uses pre-compiled expressions and cache them for high performance.

    Provides good constrol over pfecycle events.

Follows Standards

    No proprietary event system

    No dependency on any polyfill pbraries.

    No extra attributes added to existing HTML.

    Integrates well with jQuery.

Core values

RIOT.js is developed considering the following values.

    Simple and minimapstic.

    Easy to learn and implement.

    Provide Reactive Views to build user interfaces.

    Provide Event Library to build APIs with independent modules.

    To take care of apppcation behaviour with browser back button.

RIOT.JS - Environment Setup

There are two ways to use RIOT js.

    Local Installation − You can download RIOT pbrary on your local machine and include it in your HTML code.

    CDN Based Version − You can include RIOT pbrary into your HTML code directly from Content Depvery Network (CDN).

Local Installation

    Go to the https://riot.js.org to download the latest version available.

    Now put downloaded riot.min.js file in a directory of your website, e.g. /riotjs.

Example

Now you can include riotjs pbrary in your HTML file as follows −

<!DOCTYPE html>
<html>
   <head>
      <script src = "/riotjs/riot.min.js"></script>
      <script src = "https://cdnjs.cloudflare.com/ajax/pbs/riot/3.13.2/riot+compiler.min.js"></script>
   </head>
   <body>
      <messageTag></messageTag>
      <script>
         var tagHtml = "<h1>Hello World!</h1>";
         riot.tag("messageTag", tagHtml);
         riot.mount("messageTag");
      </script>
   </body>
</html>

This will produce following result −