Sha256: db002ee80afe7496daec05d43a4a2de385686078a20857236c059bb32f4d7c97

Contents?: true

Size: 606 Bytes

Versions: 23

Compression:

Stored size: 606 Bytes

Contents

require 'volt/models/persistors/base'

module Persistors
  class Params < Base
    def initialize(model)
      @model = model
    end

    def changed(attribute_name)
      if RUBY_PLATFORM == 'opal'
        %x{
          if (window.setTimeout && this.$run_update.bind) {
            if (window.paramsUpdateTimer) {
              clearTimeout(window.paramsUpdateTimer);
            }
            window.paramsUpdateTimer = setTimeout(this.$run_update.bind(this), 0);
          }
        }
      end
    end

    def run_update
      $page.params.trigger!('child_changed') if Volt.client?
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
volt-0.7.2 lib/volt/models/persistors/params.rb
volt-0.7.1 lib/volt/models/persistors/params.rb
volt-0.7.0 lib/volt/models/persistors/params.rb