Sha256: 589537ba5f0c870e73e8cb025e1825c5e2b9f0a281a052ad67bb8666ee0be34f

Contents?: true

Size: 462 Bytes

Versions: 12

Compression:

Stored size: 462 Bytes

Contents

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyalite-0.2.7 example/app/application.rb
hyalite-0.2.6 example/app/application.rb
hyalite-0.2.5 example/app/application.rb
hyalite-0.2.4 example/app/application.rb
hyalite-0.2.3 example/app/application.rb
hyalite-0.2.2 example/app/application.rb
hyalite-0.2.1 example/app/application.rb
hyalite-0.2.0 example/app/application.rb
hyalite-0.1.1 example/app/application.rb
hyalite-0.1.0 example/app/application.rb
hyalite-0.0.6 example/app/application.rb
hyalite-0.0.5 example/app/application.rb