add opal browser, find element in dom
This commit is contained in:
@ -1 +1,22 @@
|
||||
require "opal"
|
||||
require "native"
|
||||
require 'promise'
|
||||
require 'browser/setup/mini'
|
||||
|
||||
class Kanta
|
||||
def initialize(hash)
|
||||
hash.each do |k,v|
|
||||
instance_variable_set "@#{k}" , v
|
||||
self.class.define_method k.to_sym do
|
||||
instance_variable_get "@#{k}".to_sym
|
||||
end
|
||||
self.class.define_method "#{k}=".to_sym do |new_v|
|
||||
instance_variable_set "@#{k}" , new_v
|
||||
end
|
||||
end
|
||||
|
||||
def mount(on_class)
|
||||
puts $document[on_class].inner_html
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
.flex.justify-center
|
||||
#app.flex.justify-center
|
||||
.flex.flex-col
|
||||
= @image.attributes
|
||||
|
||||
@ -6,13 +6,12 @@
|
||||
Back
|
||||
|
||||
:opal
|
||||
class Kanta
|
||||
def initialize(hash)
|
||||
hash.each do |k,v|
|
||||
puts k
|
||||
puts v
|
||||
end
|
||||
end
|
||||
class Clicker < Kanta
|
||||
|
||||
end
|
||||
|
||||
kanta = Kanta.new(bg: 'bg-cyan-200')
|
||||
puts kanta.bg
|
||||
kanta.bg = "bg-cyan"
|
||||
puts kanta.bg
|
||||
kanta.mount("#app")
|
||||
|
Reference in New Issue
Block a user