Skip to content

Commit

Permalink
destroy previously stored tweets on page load
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Tusznio committed Nov 3, 2011
1 parent ca614f5 commit f1a83d5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
11 changes: 6 additions & 5 deletions index.coffee
Expand Up @@ -4,17 +4,18 @@ class Tracer extends Batman.App
query: ''
class Tracer.Tweet extends Batman.Model
@persist Batman.LocalStorage
@destroyAll: -> @get('all')?.forEach (t) -> t.destroy()
class Tracer.AppController extends Batman.Controller
index: -> @render false
index: ->
Tracer.Tweet.destroyAll()
@render false
submitSearch: =>
Tracer.set 'hasSearched', yes
Tracer.Tweet.all?.forEach (t) -> t.destroy()
Tracer.Tweet.destroyAll()
$.ajax 'http://search.twitter.com/search.json?q=' + encodeURI(Tracer.query),
dataType: 'jsonp'
success: (data) ->
for obj in data.results
tweet = new Tracer.Tweet obj
tweet.save (error, record) ->
throw error if error
false
tweet.save (error, record) -> throw error if error
Tracer.run()
25 changes: 13 additions & 12 deletions index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f1a83d5

Please sign in to comment.