lib/volt/models/persistors/store_state.rb
def change_state_to(new_state, skip_trigger=false)
    old_state = @state
    @state = new_state

    # Trigger changed on the 'state' method
    unless skip_trigger
      if old_state != @state
        @model.trigger_for_methods!('changed', :state, :loaded?)
      end
    end

    if @state == :loaded && @fetch_promises
      # Trigger each waiting fetch
      @fetch_promises.compact.each {|fp| fp.resolve(@model) }
      @fetch_promises = nil
    end
  end
# Called from the QueryListener when the data is loaded
Called from the QueryListener when the data is loaded
Called from the QueryListener when the data is loaded
def change_state_to(new_state, skip_trigger=false)
    old_state = @state
    @state = new_state
    unless skip_trigger
      if old_state != @state
        @model.trigger_for_methods!('changed', :state, :loaded?)
      end
    end
    if @state == :loaded && @fetch_promises
      @fetch_promises.compact.each {|fp| fp.resolve(@model) }
      @fetch_promises = nil
    end
  end
def change_state_to ( new_state , skip_trigger = false ) old_state = @state @state = new_state unless skip_trigger if old_state != @state @model . trigger_for_methods! ( 'changed' , :state , :loaded? ) end end if @state == :loaded && @fetch_promises @fetch_promises . compact . each { | fp | fp . resolve ( @model ) } @fetch_promises = nil end end
Called from the QueryListener when the data is loaded
Called from the QueryListener when the data is loaded
# Trigger changed on the 'state' method # Trigger each waiting fetch
new_state
skip_trigger