Sha256: 8a373fb9b5d1d6e437e1e2a5a0332df90d38de0194a2c270c2227e36a9df5e91
Contents?: true
Size: 981 Bytes
Versions: 9
Compression:
Stored size: 981 Bytes
Contents
class ReactiveTemplate include Events def initialize(page, context, template_path) # puts "New Reactive Template: #{context.inspect} - #{template_path.inspect}" @template_path = template_path @target = AttributeTarget.new(nil, nil, self) @template = TemplateRenderer.new(page, @target, context, "main", template_path) end def reactive? true end # def event_added(event, scope_provider, first, first_for_event) # if first && !@template_listener # @template_listener = @target.on('changed') { update } # end # end # # def event_removed(event, last, last_for_event) # if last && @template_listener # @template_listener.remove # @template_listener = nil # end # end # Render the template and get the current value def cur @target.to_html end def update trigger!('changed') end def remove @template.remove @template = nil @target = nil @template_path = nil end end
Version data entries
9 entries across 9 versions & 1 rubygems