Sha256: 227cb94e3f58de0b0208b4f4e18a13514e81c358979a4db96d7b9d8a30246779
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# Inesita [![Gem Version](https://badge.fury.io/rb/inesita.svg)](http://badge.fury.io/rb/inesita) [![Code Climate](https://codeclimate.com/github/fazibear/opal-virtual-dom/badges/gpa.svg)](https://codeclimate.com/github/fazibear/inesita) Frontend web framework for Opal ## requiments This wrapper require to load [virtual-dom](https://github.com/Matt-Esch/virtual-dom) first. For example you can use rails assets. ```ruby source 'https://rails-assets.org' do gem 'rails-assets-virtual-dom' end ``` ## usage Server side (config.ru, Rakefile, Rails, Sinatra, etc.) ```ruby require 'inesita' ``` Browser side ```ruby require 'opal' require 'virtual-dom' # required by opal-virtual-dom javascript library require 'browser' # not required require 'inesita' class Counter include Inesita::Component attr_reader :count def initialize(elements) @count = 0 end def inc @count += 1 update end def dec @count -= 1 update end def random_style { color: %w(red green blue).sample } end def render div do button onclick: -> { dec } do text '-' end span style: random_style do text count end button onclick: -> { inc } do text '+' end end end end $document.ready do Counter.new.mount($document.body) end ```
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
inesita-0.0.1 | README.md |