pivotal/projectmonitor

View on GitHub
app/assets/javascripts/backbone/collections/projects.js.coffee

Summary

Maintainability
Test Coverage
ProjectMonitor.Collections ||= {}

class ProjectMonitor.Collections.Projects extends Backbone.Collection
  model: ProjectMonitor.Models.Project
  url: -> "/projects" + window.location.search
  timeout: 30000

  initialize: (attributes, options) ->
    @refresh()

  refresh: =>
    @fetch()
    setTimeout(@refresh, @timeout)

  fetch: =>
    super({reset: true})