A Ruby implemented Virtual DOM in Opal
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
lib
spec
.gitignore
.ruby-version
.travis.yml
Gemfile
Gemfile.lock
LICENSE.txt
README.md
Rakefile
hyalite.gemspec

README.md

Hyalite

Build Status Gitter

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

Example

require 'hyalite'
require 'browser/interval'

class ExampleView
  include Hyalite::Component

  state :count, 0

  def component_did_mount
    every(5) do
      @state.count += 1
    end
  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.