Skip to content

youchan/hyalite

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Hyalite

Build Status Gitter

This is ruby virtual DOM implementation using opal. It is inspired by react.js.

Example

require 'hyalite'

class ExampleView
  include Hyalite::Component

  state :count, 0

  def component_did_mount
    interval = Proc.new do
      @state.count += 1
    end

    `setInterval(interval, 5000)`
  end

  def render
    div({class: 'example'},
      h2(nil, @props[:title]),
      h3(nil, "count = #{@state.count}")
    )
  end
end

$document.ready do
  Hyalite.render(Hyalite.create_element(ExampleView, {title: "Hyalite counter example"}), $document['.container'])
end

How to execute this example is the following.

> cd example
> rackup

Open url http://localhost:9292.

About

A Ruby implemented Virtual DOM in Opal

Resources

License

Stars

Watchers

Forks

Packages

No packages published