Sha256: 930b4f46205bd72c4fee37c6db6ae07811f1b01ef9fd0a6d2cd5b5d01dbff1ed
Contents?: true
Size: 958 Bytes
Versions: 1
Compression:
Stored size: 958 Bytes
Contents
require 'glimmer/data_binding/observable' require 'glimmer/data_binding/observer' module Glimmer module DataBinding class ElementBinding 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.send(@property + '=', converted_value) unless evaluate_property == converted_value end def evaluate_property @element.send(@property) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
glimmer-dsl-opal-0.0.2 | lib/glimmer/data_binding/element_binding.rb |