Class: Volt::Persistors::Params

Inherits:
Base show all
Defined in:
lib/volt/models/persistors/params.rb

Instance Method Summary collapse

Methods inherited from Base

#added, #event_added, #event_removed, #loaded, #removed

Constructor Details

#initialize(model) ⇒ Params

Returns a new instance of Params.



6
7
8
# File 'lib/volt/models/persistors/params.rb', line 6

def initialize(model)
  @model = model
end

Instance Method Details

#changed(attribute_name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/volt/models/persistors/params.rb', line 10

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

#run_updateObject



23
24
25
26
27
# File 'lib/volt/models/persistors/params.rb', line 23

def run_update
  if Volt.client?
    $page.url.update!
  end
end