lib/volt/models/persistors/array_store.rb
def load_data
      # Don't load data from any queried
      if @state == :not_loaded || @state == :dirty
        # puts "Load Data at #{@model.path.inspect} - query: #{@query.inspect}"# on #{@model.inspect}"
        change_state_to :loading

        @query_changed_listener.remove if @query_changed_listener
        if @query.reactive?
          # puts "SETUP REACTIVE QUERY LISTENER: #{@query.inspect}"
          # Query might change, change the query when it does
          @query_changed_listener = @query.on('changed') do
            stop_listening

            # Don't load again if all of the listeners are gone
            load_data if @model.has_listeners?
          end
        end

        run_query(@model, @query.deep_cur)
      end
    end
# Called the first time data is requested from this collection
Called the first time data is requested from this collection
Called the first time data is requested from this collection
def load_data
      if @state == :not_loaded || @state == :dirty
        change_state_to :loading
        @query_changed_listener.remove if @query_changed_listener
        if @query.reactive?
          @query_changed_listener = @query.on('changed') do
            stop_listening
            load_data if @model.has_listeners?
          end
        end
        run_query(@model, @query.deep_cur)
      end
    end
def load_data if @state == :not_loaded || @state == :dirty change_state_to :loading @query_changed_listener . remove if @query_changed_listener if @query . reactive? @query_changed_listener = @query . on ( 'changed' ) do stop_listening load_data if @model . has_listeners? end end run_query ( @model , @query . deep_cur ) end end
Called the first time data is requested from this collection
Called the first time data is requested from this collection
# Don't load data from any queried # puts "Load Data at #{@model.path.inspect} - query: #{@query.inspect}"# on #{@model.inspect}" # puts "SETUP REACTIVE QUERY LISTENER: #{@query.inspect}" # Query might change, change the query when it does # Don't load again if all of the listeners are gone