Sha256: 0811d187e2c4a3bcc37dfe4b1efba40385f051deb884d93f83cde65f211ed99c
Contents?: true
Size: 962 Bytes
Versions: 1
Compression:
Stored size: 962 Bytes
Contents
module Scarpe class InternalApp attr_reader :window attr_accessor :current_id def initialize(window) @window = window @current_id = object_id @callbacks = {} end def bind(name, &block) @callbacks[name] = block end def handle_callback(name, *args) @callbacks[name].call(*args) end def render(&block) instance_eval &block end def append(el) @window.eval("document.getElementById(#{current_id}).insertAdjacentHTML('beforeend', \"#{el}\")") end def para(text) Scarpe::Para.new(self, text) end def stack(&block) Scarpe::Stack.new(self, &block) end def flow(&block) Scarpe::Flow.new(self, &block) end def button(text, &block) Scarpe::Button.new(self, text, &block) end def image(url) Scarpe::Image.new(self, url) end def edit_line(&block) Scarpe::EditLine.new(self, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scarpe-0.1.0 | lib/scarpe/internal_app.rb |