Class: Scarpe::WASMButton
- Inherits:
-
WASMWidget
- Object
- Shoes::Linkable
- WASMWidget
- Scarpe::WASMButton
- Defined in:
- lib/scarpe/wasm/button.rb
Instance Attribute Summary
Attributes inherited from WASMWidget
#children, #parent, #shoes_linkable_id
Instance Method Summary collapse
- #element ⇒ Object
-
#initialize(properties) ⇒ WASMButton
constructor
A new instance of WASMButton.
Methods inherited from WASMWidget
#bind, #destroy_self, display_class_for, #handler_js_code, #html_element, #html_id, #inspect, #needs_update!, #promise_update, #properties_changed, #set_parent, #to_html
Constructor Details
#initialize(properties) ⇒ WASMButton
Returns a new instance of WASMButton.
5 6 7 8 9 10 11 12 13 |
# File 'lib/scarpe/wasm/button.rb', line 5 def initialize(properties) super # Bind to display-side handler for "click" bind("click") do # This will be sent to the bind_self_event in Button send_self_event(event_name: "click") end end |
Instance Method Details
#element ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/scarpe/wasm/button.rb', line 15 def element HTML.render do |h| h.(id: html_id, onclick: handler_js_code("click"), style: style) do @text end end end |