Sha256: afc461c569c3af9b5f8e68ef93d627c6e985a61fac7f57ce81ce1af5f8ca5702
Contents?: true
Size: 1.06 KB
Versions: 58
Compression:
Stored size: 1.06 KB
Contents
require 'glimmer/data_binding/observable' require 'glimmer/data_binding/observer' module Glimmer module DataBinding class ElementBinding # TODO consider renaming to WidgetBinding since it's no longer dealing with elements directly yet widgets instead include Glimmer include Observable include Observer attr_reader :element, :property def initialize(element, property, translator = nil) @element = element @property = property @translator = translator || proc {|value| value} # TODO see if this is needed in Opal # if @element.respond_to?(:dispose) # @element.on_widget_disposed do |dispose_event| # unregister_all_observables # end # end end def call(value) converted_value = translated_value = @translator.call(value) @element.set_attribute(@property, converted_value) unless evaluate_property == converted_value end def evaluate_property @element.send(@property) end end end end
Version data entries
58 entries across 58 versions & 2 rubygems