Class: 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.



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

def initialize(model)
  @model = model
end

Instance Method Details

#changed(attribute_name) ⇒ Object



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

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

#run_updateObject



22
23
24
# File 'lib/volt/models/persistors/params.rb', line 22

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