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, #async?, #auto_generate_id, #clear, #event_added, #event_removed, #initialize, #loaded, #removed, #root_model

Constructor Details

This class inherits a constructor from Volt::Persistors::Base

Instance Method Details

#changed(attribute_name) ⇒ Object



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

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

  true
end

#run_updateObject



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

def run_update
  Volt.current_app.url.update! if Volt.client?
end