Project

hyalite

0.04
Low commit activity in last 3 years
No release in over a year
Virtual DOM implimentation in Ruby using Opal
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0

Runtime

~> 1.0
 Project Readme

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.